add vancanhuit's Heap code

This commit is contained in:
labuladong
2020-03-06 07:57:52 +08:00
parent ce3f732f6e
commit ed22d263e3

View File

@ -211,3 +211,5 @@ Binary heap operation is very simple, mainly floating up and down, to maintain t
Priority queues are implemented based on binary heap, with the main operations being insert and delete. Insert is to insert to the end first and then float up to the correct position; Deletion is to reverse the position and then delete, and then sink to the correct position. The core code is only ten lines.
Perhaps this is the power of data structure, simple operation can achieve clever functions, really admire the invention of binary heap algorithm people!
Addition, here is an elegant implementation of Heap with python lambda from [vancanhuit](https://github.com/labuladong/fucking-algorithm/issues/157#issue-576237519).