Consider the array A = <4, 1, 3, 2, 16, 9, 10, 14, 8, 7>. After building heap from the array A, the depth of the heap and the right child of max-heap are_______ and _____ respectively. (Root is at level 0).

This question was previously asked in
UGC NET Computer Science (Paper 2) July 2018 Paper
View all UGC NET Papers >
  1. 3, 14 
  2. 3, 10
  3. 4, 14
  4. 4, 10

Answer (Detailed Solution Below)

Option 2 : 3, 10
Free
UGC NET Paper 1: Held on 21st August 2024 Shift 1
8.7 K Users
50 Questions 100 Marks 60 Mins

Detailed Solution

Download Solution PDF

Concept:

Max- heap: In max - heap, root node is always is greater than or equal to the other nodes of the tree.

Explanation:

A = <4, 1, 3, 2, 16, 9, 10, 14, 8, 7>.

STEP 1

F2 R.S Madhu 13.04.20 D1

Now, As 2 is greater than 1, there is need of rearrangement of nodes.

STEP 2:

F2 R.S Madhu 13.04.20 D2

Again exchange 16 with 2. Insert remaining nodes as per the property of max- heap.

STEP 3:

F2 R.S Madhu 13.04.20 D3

STEP 4:

F2 R.S Madhu 13.04.20 D4

STEP 5:

After inserting all the nodes in this way, final max - heap is:

F2 R.S Madhu 13.04.20 D5

As, root is at level 0, So, there are total 3 levels in this max - heap. Also, right child of root node is 10.
Latest UGC NET Updates

Last updated on Jun 6, 2025

-> The UGC NET Exam Schedule 2025 for June has been released on its official website.

-> The UGC NET Application Correction Window 2025 is available from 14th May to 15th May 2025.

-> The UGC NET 2025 online application form submission closed on 12th May 2025.

-> The June 2025 Exam will be conducted from 21st June to 30th 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 Sorting Questions

Get Free Access Now
Hot Links: teen patti real money app online teen patti teen patti yas