UGC-NET | UGC NET CS 2017 Jan – II | Question 21

Which of the following is true for computation time in insertion, deletion and finding maximum and minimum element in a sorted array ?
(A) Insertion – 0(1), Deletion – 0(1), Maximum – 0(1), Minimum – 0(l)
(B) Insertion – 0(1), Deletion – 0(1), Maximum – 0(n), Minimum – 0(n)
(C) Insertion – 0(n), Deletion – 0(n), Maximum – 0(1), Minimum – 0(1)
(D) Insertion – 0(n), Deletion – 0(n), Maximum – 0(n), Minimum – 0(n)


Answer: (C)

Explanation:

  1. In a sorted array, if we want to insert or delete then we have to traverse whole array and check where is the suitable position, so it will take
    O(n).
  2. If array is sorted then end position will tell the maximum or minimum, so finding maximum or minimum will take O(1).

So, option (C) is correct.


Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.