Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations - NIMCET

Previous Year Question (PYQs)



Given the index i of a node in a heap, we can not compute: 
1. Parent () 
2. Heap size 
3. Left (i) 
4. Right (i)





Solution

In a binary heap (array representation):

Parent(i) = \(\left\lfloor \tfrac{i}{2} \right\rfloor\),   Left(i) = \(2i\),   Right(i) = \(2i+1\)

All three can be computed directly from the index i.

But the heap size depends on the total number of elements \((n)\), which cannot be determined from i alone.

\(\therefore\) Correct Answer: (2) Heap size



Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Ask Your Question or Put Your Review.

loading...