uva-cs / pdr

A repo for a Program and Data Representation university-level course
Other
91 stars 227 forks source link

Print binary heap in tree form #53

Open adeet1 opened 4 years ago

adeet1 commented 4 years ago

This pull request improves the print() method in binary_heap.cpp by printing the heap as a tree instead of as an array, making it easier to visualize the heap.

createTree() is a helper method, which iterates through each element in the heap array to create a binary tree from the array.

Notes: 1) The print functionality itself is taken from lab 5. 2) Please ignore commit 05dc0cb, as it is a duplicate of the commit in the previous pull request.