Tag tree

Binary Search Trees

A binary search tree is a fairly useful structure for storing ordered data. The invariant for a binary search tree is straightforward:...

Heap Sort

One way to sort a list is to use the heap data structure. Given an array of \(N\) unsorted elements, build a max heap in place. Start...

Binary Heaps & Priority Queues

At times we want a structure similar to a queue or stack, but instead of LIFO or FIFO, we want it to pop the maximum element each time....