edited by
1,129 views
3 votes
3 votes
Given a set of n distinct integers, it is required to determine the three smallest integers of this array using comparisons, The no of comparison needed are

(A)   n + O( log n )

(B)  n + O( 1 )

(C) O ( n )

(D)   O ( log2n )

ANSWER GIVEN ::-  A
edited by

1 Answer

0 votes
0 votes

construction of build heap it will take  n comparisons{minheap}

after that you have to delete root element for minimum(you have to replace root will last element of tree it will take log(n) time to maintain heap property ).you have to delete three element it will take time more than 3*log(n).thats why it will take in ans O(LOG(N))

 so Total comparisons = N+O(log(n))

in question is not asking for time complexity( in this case ans will be C ).

https://gateoverflow.in/190750/ace-test-series-algorithms-sorting

Related questions

652
views
0 answers
0 votes
870
views
1 answers
1 votes
rahul sharma 5 asked Dec 30, 2017
870 views
Let the size of congestion window of a TCP connection be 38 KB when a timeout occurs. The propagation time of the connection is 100 msec and the maximum segment ... ) by the TCP connection to get back to 36 KB congestion window is ________.
948
views
1 answers
1 votes
rahul sharma 5 asked Dec 30, 2017
948 views
In synchronous transmission, 5 eight bit characters are included in 30 eight bit information characters. If bit rate of sender is 4200 bits/sec, what is the bit rate of receiver (in bits per sec)?
793
views
0 answers
2 votes
rahul sharma 5 asked Dec 30, 2017
793 views
Assume there are 100 nodes are connected to a 1000 meter length of the coaxial cable. Using some protocol, each node can transmit 50 frames/second, where the average ... place)I got .125 but given is 12.5%?Please check which is correct?