Update README.md

This commit is contained in:
marina 2023-08-02 13:31:19 -07:00 committed by GitHub
parent 07f6564fe6
commit 4caa1fe7f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -229,3 +229,19 @@ class MaxHeap:
return str(self.maxheap[1 : self.realsize + 1]) return str(self.maxheap[1 : self.realsize + 1])
``` ```
<br>
---
### heap sort
<br>
* the core concept of the heap sort involves constructing a heap from our input and then repeatedly removing the min/max element to sort the array.
* the key idea for in-place heap sort involves a balance of these two ideas:
- building a heap from an unsorted array through a "bottom-up heapification" process, and
- using the heap to sort the input array
* heapsort traditionally uses a max-heap to sort the array, although a min-heap also works.
* this is not a stable sort.