The Gateway to Computer Science Excellence
+1 vote
132 views
Where in a max-heap might the smallest element reside, assuming that all elements are distinct ?
in Algorithms by
retagged by | 132 views
0
Smallest element will be at the last level of the max heap.

2 Answers

0 votes
smallest element will b at last level of the max heap
by
+1
Not necessarily at last level. Minimum element will be at the leaf node. Eg. consider this max heap 5,4,2,3.

Here 2 is at 2nd level.
0 votes
The smallest element in a max-heap will be present at the last level of a max-heap whose index start from floor(n/2)+1, floor(n/2)+2 ...., n.
ago by
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
52,375 questions
60,585 answers
202,002 comments
95,407 users