First page Back Continue Last page Overview Graphics
Insert into sorted collections
Finding the right spot is O(log N)
- Binary search on the element to insert
-
Performing the insertion O(N)
- Shuffle the existing elements to make room for the new item
These are sequential steps, add their complexities
- Total = O(log N + N) = O(N)
Notes: