979 views
1 1 vote
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 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
Position:
Show:

Related questions

1 1 vote
0 0 answers
2.8k
2.8k views
Lakshman Bhaiya asked Nov 1, 2018
2,778 views
$(1)$ In a binary heap with $'n'$ elements with the smallest element at the root, the $7th$ smallest element can be found in time?$A)\theta(nlogn)$ $B)\theta(n...
0 0 votes
0 0 answers
529
529 views
iarnav asked Jun 24, 2018
529 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...
1 1 vote
1 1 answer
504
504 views
air1air2 asked Dec 8, 2024
504 views
7 7 votes
2 2 answers
2.8k
2.8k views
Warlock lord asked Dec 5, 2017
2,800 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 ...