edited by
302 views
0 votes
0 votes
Consider the array of size n. the first (n – 1) elements are already sorted. What is the worst case time complexity to insert a nth element in an array after insertion the array should be in sorted order??
edited by

1 Answer

1 votes
1 votes
O(n) as it will take logn time to find the place of the value and in worst case O(n) time to insert the value.

Related questions

1 votes
1 votes
0 answers
1
0 votes
0 votes
1 answer
2
0 votes
0 votes
3 answers
3
0 votes
0 votes
1 answer
4
Deepalitrapti asked Sep 11, 2018
335 views