Question DSA-HEAP-0011
MediumIn an array-based min-heap (0-indexed), where is the parent of the element at index i?
- A.
i // 2 + 1
- B.
2i + 1
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Heaps and Priority Queues question
In an array-based min-heap (0-indexed), where is the parent of the element at index i?
i // 2 + 1
2i + 1
Sign up free to see the answer and a step-by-step explanation.
i − 1
(i − 1) // 2