Question: ou are given a maxheap ( keeps the largest value at the root ) , which has 4 functions push ( h , v )

ou are given a maxheap (keeps the largest value at the root), which has 4 functions
push(h,v), v<-pop(h), new(h), and b<-isNotEmpty(h),
where h is a heap, v is the value pushed/popped on the heap, new creates a new empty heap,
isNotEmpty tests the heap, and b is a Boolean. Assume h is passed by reference, so it can be
changed. What will this pseudocode program print? [5 points]
new(h);
push(h,30);
push(h,-100);
push(h,-20);
push(h,0);
push(h,50);
while (isNotEmpty(h)) do {
printf(%d ,pop(h));
}
printf(
);
7
49
268 B
135 A C

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!