id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

norm.krumpe@muohio.edu > removeMaxFromHeap
prev  |  next  |  chance

Given an array of positive integers that represents a max heap, show the array after removing the largest element and fixing the heap (using the same algorithm from class and from your textbook). Set the final element in the array to 0 to indicate that it is empty. Do not create a new array. Just modify and return the given array. When moving a node downward, if both children have the same value, choose the child on the left.


removeMaxFromHeap([0, 7]) → [0, 0]
removeMaxFromHeap([0, 12, 5]) → [0, 5, 0]
removeMaxFromHeap([0, 12, 5, 7]) → [0, 7, 5, 0]

...Save, Compile, Run (ctrl-enter)

int[] removeMaxFromHeap(int[] nums) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 200

Copyright Nick Parlante 2017 - privacy