Starting from:
$35

$29

Heaps used for Sorting Lab Solution

Using only an array/list/vector (depending on your language of choice), construct a max-heap data structure. Then, read in 10 numbers from the screen, 1 line at a time. Store each one in your max-heap, one at a time. Then, output the numbers in descending order, one line at at time, by repeatedly retrieving and deleting the largest item from the heap.




You must use a max-heap to solve this problem, and you must implement the heap yourself using an array/list/vector. No other data structure will be permitted.




Note: You must not submit your "node_modules" folder if you are working on NodeJs/JavaScript. (Just submit your JavaScript source code and package.json file)

More products