Back to Browse

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

1.9K views
May 30, 2021
11:52

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: Data Structures in Python: https://www.thinkxacademy.com/Data%20Structures%20in%20Python 🌐Join our community: Android App(Notes+Videos): https://play.google.com/store/apps/details?id=com.thinkx.thinkx Facebook: https://www.facebook.com/thinkxacademy Twitter: https://www.twitter.com/thinkxacademy Instagram: https://www.instagram.com/thinkxacademy #heap #datastructures #masterdsalgo #python

Download

1 formats

Video Formats

360pmp414.4 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

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