Algorithms: the heap is amazing! Here is one more reason why: the asymptotic cost to build one.
One further remarkable feature of the heap data structure is that it can be built, in place, from an unsorted array, not even in n log n but in linear time! This won’t reduce the time complexity of heapsort, which is already optimal, but it’s nonetheless pretty cool.
If you like this video, give it a thumbs up. Subscribe and hit the notification bell for more of the same. Leave your comments below.
Course web page:
https://www.cl.cam.ac.uk/teaching/current/Algorithms/
Course handout:
https://www.cl.cam.ac.uk/teaching/2021/Algorithms/2020-2021-stajano-algs-handout.pdf
My home page:
https://www.cl.cam.ac.uk/~fms27/
Add comment