edited by
551 views
0 votes
0 votes
Consider there are n/logn min heap trees each of size logn. What will be the time complexity to find the smallest element and greatest element in these min heap trees respectively?

A) O(n/logn), O(n)
B) O(n),  O(n/logn)
C) O(n), O(n)
D) O(logn), O(logn)
edited by

1 Answer

2 votes
2 votes
There are n/logn heaps... so the first or root of them is the minimum among them... comaparing roots of all n/log list will take O(n/logn)..

Now the maximum of any mean heap lies in the leaf which are logn/2 in above conditions... so total number of leaves are (n/logn)*(logn/2)=n/2.. so total time will be O(n)

Related questions

0 votes
0 votes
0 answers
1
pps121 asked Dec 2, 2018
263 views
Consider the following possible outcomes of executing a Turing machine over a given input. Which of the following outcome is NOT possible?A)TM halts and accepts the input...