Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

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

  • Last Updated : 23 Mar, 2018

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
Recommended Articles
Page :