eschombu / cisc4080

Fordham CISC 4080 Computer Algorithms
0 stars 3 forks source link

Changed `keys` from `map` to `vector` #2

Open prof-erik opened 6 years ago

prof-erik commented 6 years ago

https://github.com/prof-erik/cisc4080/blob/568984a1b3e587f0650c5a7a78bd524f6deca8d0/bin_heap.h#L16-L17

I often find it convenient to work with maps and started with one, but I think it was an unnecessary and potentially confusing choice here. I have instead changed the keys container to be an instance of class vector<key_type>. That way you can treat the values and keys containers similarly, and the index for a particular element's value is then the same as the element's key in the BinaryHeap.

Comment here if you have any questions or concerns!