450 views
1 votes
1 votes
In a binary Heap of 100 elements time taken to find the 99th element?

or in a binary heap on "n" elements, time taken to find (n-1)th element?

 

Note ; I'm not asking about smallest or largest, but simply the 99th element.

1 Answer

Best answer
6 votes
6 votes
If you are not asking for 99th smallest or largest element then I assume you are interested in the 99th position of the Array as Heap is nothing but an array with Heap property.

In Array, Direct access to any index is possible, Hence, You can access $n-1$th position of the array in $O(1)$ time.
selected by

Related questions

0 votes
0 votes
0 answers
2
iarnav asked Jun 24, 2018
254 views
The number of possible min-heaps containing each value from {1,1,1,1,1,1,1} exactly once is _______This is a variance of Gate 2018 question and how will we deal if all va...
7 votes
7 votes
2 answers
3
Warlock lord asked Dec 5, 2017
1,103 views
From an array of size n , we need to find the k bigger elements. What is the data structure we should use to find k bigger element in best asymptotic complexity? 1.A max ...
0 votes
0 votes
0 answers
4
Balaji Jegan asked Jun 17, 2018
219 views
What is the recurrence relation / math expression for the number of binary min heaps possible with "n" elements on which "k" elements are repeated "t" times where t=2 to ...