17/41
Part 3 of 7 · bisectLearn and do

insort finds the spot in O(log n), then shifts everything after it in O(n)

Finding the spot is cheap. Making room isn't.

Predict

insort(a, 140) on a = [100, 130, 160, 220, 300]. How many items move to make room?

Pick an answer above to see the rest