An efficient solution based on hash map is discussed. We need to check the Horizontal Distances from root for all nodes and two nodes have the same
binary tree traversal
Sorted order printing of a given array that represents a BST – Binary Search Tree – Given an array that stores a complete Binary Search Tree,
An efficient solution based on hash map is discussed. We need to check the Horizontal Distances from root for all nodes and two nodes have the same.
C program to check if a binary tree is BST or not – Binary Search Tree – A binary search tree (BST) is a node based binary tree data structure.
Binary Tree Properties – Binary Tree – Here level is number of nodes on path from root to the node (including root and node). Level of root is 1.
Binary Tree (Types of Binary Tree) – A Binary tree is Perfect Binary Tree in which all internal nodes have two children and all leaves are at same level.
A Problem in Many Binary Search Implementations – Searching and Sorting – The above looks fine except one subtle thing, the expression “m = (l+r)/2”. It fails for large values of l and r. Specifically, it fails if the sum of low and high is greater than the maximum positive int value (231– 1).
Heap Sort – Searching and Sorting – Heap sort is a comparison based sorting technique based on Binary Heap data structure. It is similar to selection sort.where we first find the maximum element and place the maximum element at the end.
Binary Search – search and sorting – Search a sorted array by dividing the search interval in half. Begin with an interval covering the whole array.