Examples
Heads up: although WingNotes is still useable at your current screen size, it's best viewed using a desktop browser instead!
Heap-Sort Sorting Strategy:
- Build Max Heap from unordered array
- Find maximum element A[1];
- Swap elements A[n] and A[1]: now max element is at the end of the array!
- Discard node n from heap (by decrementing heap-size variable)
- New root may violate max heap property, but its children are max heaps. Run max_heapify to fix this.
- Go to Step 2 unless heap is empty.