Micro Assignment #4 – Heap Percolating Solved

25.00 $

Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: . zip solution files instantly, after Payment


5/5 - (5 votes)

Micro Assignment #4 – Heap Percolating
For this micro assignment, you must implement the following functions found inside Heap.h.
Note that our heap is a min-heap (smallest items at the top)!
void percolateDown(int index)
void percolateUp(int current_position)
These functions cause the items at the supplied locations to “percolate down” and “percolate up” the heap until the min-heap property is satisfied. percolateDown is called on deleteMin operations; see the deleteMin function inside Heap class to see how percolateDown is called. Note that we’re being good programmers and allowing the heap to percolate down at any point, not just the root! Doing so
allows us to evoke the percolate down functionality in other situations (e.g. buildHeap).
The percolateUp function is called on insert() calls and moves any given index up in the tree until it satisfies the heap properties of our min heap.
I have tested this code on the EECS SSH server, ssh8. I used the command line:
g++ -g -Wall -std=c++0x main.cpp
You can run this with ‘make’, ‘make test’, and ‘make run’ as per usual
It built and runs properly. The tests for insert and delete currently fail, which is what you’re going to fix.
Your submission will be graded based on the following:
1. [10] Your solution builds, does not cause any runtime issues, and passes all test cases

  • Simple-Heap.zip