• retagged by
2,023 views

3 Answers

Best answer
3 3 votes

is anythng i miss?

• selected by
0 0 votes
Minimum number of comparison is O(1) ,when we know array is sorted.

But here we donot know array as sorted

So, minimum no. comparison and maximum number of comparison=O(n)=3/2n-2 comparisons

For 19 element , in worst case it will be (3/2*19-2) comparison.
• edited by
0 0 votes
We have to do (n-1) comparison , so for 19 elements total comparison requires is 18.
Position:
Show:

Related questions

8 8 votes
6 6 answers
3.9k
3.9k views
Arjun asked Feb 27, 2025
3,912 views
Suppose that insertion sort is applied to the array $[1,3,5,7,9,11, x, 15,13]$ and it takes exactly two swaps to sort the array. Select all possible values of $x$.$10$$12...
60 60 votes
4 answers 4 answers
25.2k
25.2k views
Arjun asked Feb 12, 2020
25,150 views
Consider a double hashing scheme in which the primary hash function is $h_1(k)= k \text{ mod } 23$, and the secondary hash function is $h_2(k)=1+(k \text{ mod } 19)$. Ass...
3 3 votes
1 answers 1 answer
2.6k
2.6k views
Rohan Mundhey asked Nov 9, 2016
2,592 views
Consider an array contains 2k distinct elements. How many comparisons are needed to find the smallest and the second smallest elements in the given array? 2k comparisons ...
3 3 votes
3 3 answers
2.5k
2.5k views
Himanshu1 asked Dec 16, 2015
2,537 views
Assume that array $A$ and $B$ both are sorted, each contain ' $N$ ' element. What is the worst case time complexity to find median of $A \cup B$ ?$\mathrm{O}(\log \mathrm...