Heap

In today’s topic, I will be talking about HEAP . Just like AVL Tree and B-Tree, Heaps is also part of the Binary Search Tree. So what makes heap different? If in AVL Tree , every time we input something they will be sorted in a way that the left child will always have less value than the parent and the right child will have greater value than the parent and each node will be assigned to a height, in Heap the data will be inserted based on their arrival from the most left whether it satisfies the Binary Search Tree rules or not but we have to keep in mind that the parent node should be greater or equal to the key value of the child node for when it’s Max-Heap and less or equal to the key value of the child node for when it’s Min-Heap and each node will be assigned to a key based on their place on the tree. To understand more about the difference, here’s an example of insertion for AVL Tree and Max-Heap. Say that the inserted data queue are, 35, 33, 42, 10, 14, 19, 27,...