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

 

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

Given an array of positive integers that represents a max heap, (except for the first value which is always empty, and the last value which represents a node where we will put a new value), add the given value to the heap using the technique shown in class and in your textbook. Do not create a new array. Just modify and return the given array.


addToMaxHeap([0, 12, 7, 5, 0], 8) → [0, 12, 8, 5, 7]
addToMaxHeap([0, 10, 6, 10, 0], 99) → [0, 99, 10, 10, 6]
addToMaxHeap([0, 99, 10, 10, 6, 0], 12) → [0, 99, 12, 10, 6, 10]

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

int[] addToMaxHeap(int[] nums, int val) { }

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: 100

Copyright Nick Parlante 2017 - privacy