recategorized
3,607 views
0 votes
0 votes

Which of the following is true for computation time in insertion, deletion and finding maximum and minimum element in a sorted array ?

  1. Insertion – $0(1)$, Deletion – $0(1)$, Maximum – $0(1)$, Minimum – $0(1)$
  2. Insertion – $0(1)$, Deletion – $0(1)$, Maximum – $0(n)$, Minimum – $0(n)$
  3. Insertion – $0(n)$, Deletion – $0(n)$, Maximum – $0(1)$, Minimum – $0(1)$
  4. Insertion –  $0(n)$, Deletion – $0(n)$, Maximum – $0(n)$, Minimum – $0(n)$
recategorized

5 Answers

0 votes
0 votes
since the array is sorted,

1) for insertion of the element in the array find it's right position to insert which can take O(n).

2) for deletion of element find the element to be deleted which again can take O(n).

3) as the array is already sorted first and the last element will be minimum and maximum element respectively if in ascending order. so this operation will be of O(1).

so option c is correct.
Answer:

Related questions

0 votes
0 votes
4 answers
7
go_editor asked Mar 24, 2020
985 views
Match the following :$\begin{array}{llll} & \textbf{List – I} & {} & \textbf{List – II} \\ \text{a.} & \text{Absurd} & \text{i.} & \text{Clearly impossible being con...