Takeaways
- A heap is a complete binary tree that follows the heap property.
- Heap property: Parent is greater that it's children (Max heap) OR Parent is less than it's children (Min heap).
- Heapify is the operation done that restructures the heap to satisify the heap property.
- Heaps are typically implemented as an array.
- Inserting and removing is O(logn) time.
- HeapSort is a sorting algorithm that uses a heap to sort an array
- Huffman Coding is a String encoding technique that uses a binary tree to generate encodings
- Huffman coding is also a data compression technique (less bits are used compared to UTF or ASCII)
Code
March 4th code is a Min heap implementation.
March 6th is a Huffman Coding implementation