Algorithm - the time complexity of deletion in a unsorted array

后端 未结 4 1119
庸人自扰
庸人自扰 2021-01-01 03:29

Suppose there is a unsorted array A, and it contains an element x (x is the pointer of the element), and every element has a satellite variable k. So, we can get the followi

4条回答
  •  一个人的身影
    2021-01-01 04:24

    Worst case time complexity for deletion operation in a sorted array is O(n), If the array is not sorted and it is mentioned that after deletion operation order of the array shouldn't be altered then time complexity will be same as O(n) otherwise it will be O(1).

提交回复
热议问题