470 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
266 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,152 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
1 answer
4
Overflow04 asked Jun 29, 2022
2,129 views
Someone please explain the login behind the explanation.