Preparing for software engineering interviews? I’d love your help.
I’m researching how engineers prepare, what’s helped, and what’s been difficult. If you’re preparing now or have prepared in the last two years, I’d love to hear your experience.
As a thank-you, I’ll give you early access to the interview prep tool I’m building. I’m putting a lot into it, and I promise it’ll be worth trying!
Take part here: https://clarifywhy.com/s/PGYdfpX5ZL8y
Please finish the full interview. It asks for your contact details at the end, so I’ll know where to send your early access invitation.
Thanks for helping me build something useful!
Moein
––––––––––––––––––––––––––––––
Heap sort is a comparison based, in-place sorting algorithm. We can think of it as an improved version of selection sort as it divides the input into a sorted section and an unsorted section, but interestingly it keeps the unsorted section a max-binary-heap. This helps the heap sort to achieve the worst-case time complexity of O(nlogn).
In this video, we talk about the max-binary-heap, and the heapify function and discuss how to convert an array into a max-binary-heap. Then we will use all of this stuff to understand and implement heap-sort.
If you’re interested in max-heap, min-heap and priority queue as well, this video can help you to understand the underlying data structure.
Chapters:
0:00 Introduction and Agenda
0:50 What is Max-Binary-Heap
1:39 How to store a heap into an array
3:02 Heapify
4:09 Heapify Code
5:35 Building a Max-Binary-Heap
7:28 Build-Max-Heap Code
7:42 Heap Sort
8:45 Heap Sort Code
9:15 Heap Sort Misc
#algorithm #datastructures #datastructure #sorts #sort #heap #python
- - - -
Music by INOSSI
Listen: https://spoti.fi/2EzvEA6
Watch: • INOSSI - Waiting (Official)
- - - -