[6.1] Introduction to Heap Data Structure | Data Structures in Python

preview_player
Показать описание
Heap Data Structure:
Binary Heap: It is the binary tree representation of a given array.
3 conditions to build the heap:
1) root = Array[0]
2) left = Array[(2*i) + 1]
3) right = Array[(2*i) + 2]
Using these 3 rules we can obtain a binary heap
Binary Heap can be further changed to Max Heap or a Min Heap. This is useful when we want to use heap as a priority queue.
Max Heap Property: value(parent) is greater than value(child nodes)
Min Heap Property: value(parent) is less than value(child nodes)
In case of max heap root represents the maximum element of the whole tree which is true for all subtrees as well.

🔗Important Links:

🌐Join our community:
#heap #datastructures #masterdsalgo #python
Рекомендации по теме
Комментарии
Автор

Thnx sir 🙌 for such a valuable content😇👌

saa_vlogs
Автор

I've been waiting for this for a long time. Pls complete the remaining ds topics in python.
Thank you sir

snehaloganathan
Автор

Can you pls upload graphs in ds as soon as possible sir.

snehaloganathan
join shbcf.ru