Heap sort in 7 minutes | Python

Heap sort in 7 minutes | Python

CodingCat Leo

55 лет назад

183 Просмотров

#algorithm #sorting #python
You will learn about:
00:00 What is Heap
01:38 Build heaplify function
03:44 How to convert Array into Heap
04:01 How to build Max Heap
05:30 How to implement HeapSort
06:46 Python code

Leetcode question: https://leetcode.com/problems/sort-an-array/description/

Leetcode code solution: https://leetcode.com/problems/sort-an-array/solutions/5148686/video-heap-sort

Definition:
The heapsort algorithm can be divided into two phases: heap construction, and heap extraction.

The heap is an implicit data structure that takes no space beyond the array of objects to be sorted; the array is interpreted as a complete binary tree where each array element is a node and each node's parent and child links are defined by simple arithmetic on the array indexes.
Ссылки и html тэги не поддерживаются


Комментарии: