747 views
4 votes
4 votes
A min heap with 1000 elements is stored in an array. What is the maximum possible index number for 9th min element?

A) 254

B) 100

C) 9

D) 511

1 Answer

Best answer
6 votes
6 votes

D. 511

Logic is how much can we push 9th min element towards the bottom of the min_heap ? it is upto the $9$th level.

If we assume numbers to be $1,2,3,4,5...1000$ Then following is a possible arrangement.



Put $9$th minimum in the extreme right corner of the heap in the $9$th level. Remaining nodes we can fill up in ascending order from the unused numbers.

For example

edited by

Related questions

11.1k
views
1 answers
1 votes
Pranabesh Ghosh 1 asked Aug 30, 2016
11,079 views
Suppose we are sorting an array of ten integers using a some quadratic sorting algorithm. After four iterations of the algorithm's main loop, the array ... be selection sort.D) The algorithm is neither selection sort nor insertion sort.
607
views
2 answers
0 votes
Pranabesh Ghosh 1 asked Aug 30, 2016
607 views
Given an array of integers what is the worst case time complexity that would find pair of integers which are same?A) O(nlogn)B) O(n)C) O()D) O(nloglogn)
824
views
1 answers
2 votes
Pranabesh Ghosh 1 asked Aug 30, 2016
824 views
Suppose that an application have a huge number of insert operations, but only few delete max operations. Which priority-queue implementation would be most effective:A) Max heapB) unordered arrayC) ordered arrayD) Binary search tree
322
views
1 answers
0 votes
Pranabesh Ghosh 1 asked Aug 30, 2016
322 views
What is the time complexity to check whether an array is binary min heap or not?A) (n)B) (logn)C) (nlogn)D) (