Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The largest element in a heap must appear in position 1, and the2nd largest elem

ID: 3617460 • Letter: T

Question

The largest element in a heap must appear in position 1, and the2nd largest element must be in position 2 or position 3. Givethe list of positions in a heap of size 15 where the kth largestelement i) can appear and ii) cannot appear, for k = 2,3,4(assuming values to be distinct).
You must know about heaps and that a heap is a tree in whichthe two children of a parent node are smaller than it.
I'd really appreciate help on this and WILL RATE LIFESAVER fora right answer!
This is what I got - please let me know if it's right and ifit's wrong, where and why?:
for k=2: i) position 2, 3 ii) position 1, 4-15
for k=3: i) position 2 - 7 ii) position 1, 8-15
for k=4: i) position 4-13 ii) position 1-3, 14, 15
You must know about heaps and that a heap is a tree in whichthe two children of a parent node are smaller than it.
I'd really appreciate help on this and WILL RATE LIFESAVER fora right answer!
This is what I got - please let me know if it's right and ifit's wrong, where and why?:
for k=2: i) position 2, 3 ii) position 1, 4-15
for k=3: i) position 2 - 7 ii) position 1, 8-15
for k=4: i) position 4-13 ii) position 1-3, 14, 15 for k=2: i) position 2, 3 ii) position 1, 4-15
for k=3: i) position 2 - 7 ii) position 1, 8-15
for k=4: i) position 4-13 ii) position 1-3, 14, 15

Explanation / Answer

//hope this will help you. for k=2,3 are right, but for k=4 answer is for k=4: i) position 1-15 ii) position - none like 15 is root, and 2nd level rightmost is 14 and 2nd level rightmost is 13 and 2nd level rightmost is 12 and other any number satisfy max heap property. so you can see, 15 position can be filled by 4th maximum.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote