Year End Sale: Get Upto 40% OFF on Live Training! Offer Ending in
D
H
M
S
Get Now

Java: Convert Min Heap to Max Heap

Level : Intermediate
Mentor: Shailendra Chauhan
Type : GuidedLab
Points : 10
Duration : 00:30:00

Lab Details

Problem Statement:

Given an array representation of min Heap, convert it to max Heap.

Input:

arr[] = {3, 5, 9, 6, 8, 20, 10, 12, 18, 9}
3
/ \
5 9
/ \ / \
6 8 20 10
/ \ /
12 18 9

Output:

arr[] = {20, 18, 10, 12, 9, 9, 3, 5, 6, 8}
  20
  / \
 18  10
/ \  / \
12 9 9 3
/ \ /
5 6 8
Self-paced Membership
  • 24+ Video Courses
  • 825+ Hands-On Labs
  • 400+ Quick Notes
  • 125+ Skill Tests
  • 10+ Interview Q&A Courses
  • 10+ Real-world Projects
  • Career Coaching Sessions
  • Email Support
Upto 60% OFF
Know More
Still have some questions? Let's discuss.
CONTACT US
Accept cookies & close this