Binary Heap is the underlying implementation of Priority Queue. A heap can be visualized to have a tree structure logically. This tree satisfies the two heap properties - value property and the shape property. Although the heap is a tree, because of the heap property it's easy to implement it as an array. Binary Heap is… Continue reading Heap – Theory
Tag: Binary Tree
Binary Tree – Set 3
BT Set – 2, BT Set – 1, Question Set (101- ..) Binary Tree Visualizer ** Remove nodes on root to leaf paths of length < K. GFG Algo: We do a postorder traversal and in each iteration we also path the length till node. When we reach a leaf node, we check if the… Continue reading Binary Tree – Set 3
Binary Tree – Set 2
Imp -> 1, 3, 6, 8, 10, *11, 14, 15, 16, 18, **23, 24, 25, **26, 27, 29, 31, 34, 35, 36, 43 Pending 27, 38 BT Set - 1, BT Set - 3 , Question Set(41-101) Binary Tree Visualizer *** Populate Inorder Successor for all nodes GFG Code Algo: 1. Traverse the given tree in reverse… Continue reading Binary Tree – Set 2
Self Balancing Binary Tree
AVL Tree Implementation. Code. GFG - Insert, Delete Youtube Time Complexity: The rotation operations (left and right rotate) take constant time as only few pointers are being changed there. Updating the height and getting the balance factor also take constant time. So the time complexity of AVL insert remains same as BST insert which is O(h) where… Continue reading Self Balancing Binary Tree
Binary Tree – Set 1
InterviewBit Imp - 3, 4, 9, 10, 12, 15, 17, 19, 24, 27 Less Imp - 8, 22, 25, 26 Pending - 14 BT Set - 2(42), BT Set - 3 (17), Question Set (1- 40) Binary Tree Visualizer *** Binary Tree Traversal. Depth First Traversals: Code GFG Time Complexity: O(n) where n is number of nodes in… Continue reading Binary Tree – Set 1
You must be logged in to post a comment.