Consider an array representation of an n element binary heap where the elements are stored from index 1 to index n of the array. For the element stored at index i of the array (i < = n), the index of the parent is:

This question was previously asked in
UGC NET Computer Science (Paper 2) Nov 2017 Official Paper
View all UGC NET Papers >
  1. floor ((i + 1) / 2)
  2. ceiling ((i + 1) / 2
  3. floor (i / 2)
  4. ceiling (i / 2)

Answer (Detailed Solution Below)

Option 3 : floor (i / 2)
Free
UGC NET Paper 1: Held on 21st August 2024 Shift 1
10.8 K Users
50 Questions 100 Marks 60 Mins

Detailed Solution

Download Solution PDF

The correct answer is "option 3".

CONCEPT:

The binary heap is a complete binary tree with heap properties.

Binary heap is either max. heap (root value > all key values) or min. heap. (root value < all key values).

EXPLANATION:

Binary heap elements can be represented using an array with index value i (i < = n),

Parent node of element will be at index: floor (i / 2)

Left Child node will be at index: 2 * i

Right child node will be at index: 2 * i + 1

Hence, the index of the parent is floor (i / 2).

Latest UGC NET Updates

Last updated on Jun 12, 2025

-> The UGC NET June 2025 exam will be conducted from 25th to 29th June 2025.

-> The UGC-NET exam takes place for 85 subjects, to determine the eligibility for 'Junior Research Fellowship’ and ‘Assistant Professor’ posts, as well as for PhD. admissions.

-> The exam is conducted bi-annually - in June and December cycles.

-> The exam comprises two papers - Paper I and Paper II. Paper I consists of 50 questions and Paper II consists of 100 questions. 

-> The candidates who are preparing for the exam can check the UGC NET Previous Year Papers and UGC NET Test Series to boost their preparations.

More Binary Heap Questions

Get Free Access Now
Hot Links: teen patti joy 51 bonus teen patti online game teen patti all