A tree is a data structure similar to a linked list but instead of each node pointing simply to the next node in a linear fashion, each node points to a number of nodes. Tree is an example of a non- linear data structure. A tree structure is a way of representing the hierarchical nature of a structure in a graphical form.
A tree is called binary tree if each node has zero child, one child or two children. Empty tree is also a valid binary tree. We can visualize a binary tree as consisting of a root and two disjoint binary trees, called the left and right subtrees of the root.
- Inserting an element into a tree
- Deleting an element from a tree
- Searching for an element
- Traversing the tree
- Finding the size of the tree
- Finding the height of the tree
- Finding the level which has maximum sum
- Finding the least common ancestor (LCA) for a given pair of nodes, and many more.
In binary search trees, all the left subtree elements should be less than root data and all the right subtree elements should be greater than root data. This is called binary search tree property. Note that, this property should be satisfied at every node in the tree.
- The left subtree of a node contains only nodes with keys less than the nodes key.
- The right subtree of a node contains only nodes with keys greater than the nodes key.
- Both the left and right subtrees must also be binary search trees.
- Find/ Find Minimum / Find Maximum element in binary search trees
- Inserting an element in binary search trees
- Deleting an element from binary search trees
- Finding k th -smallest element in tree
- Sorting the elements of binary search tree and many more
- Check Whether given Binary Tree is BST ----> C++ | Java | Python
- AVL Tree ----> C++
- BFS traversal on Binary Tree ----> C++
- Bottom-View of a Binary tree ----> C++
- Check if a Binary Tree is a valid Binary Search Tree ----> Java
- DFS Traversal in Binary Tree ----> Java
- Construction of binary tree from preorder and inorder traversal ----> C++
- DFS traversal on Binary Tree ----> C++
- Diameter of Binary Tree ----> C++
- Distance between two nodes of a binary tree ----> C++
- Largest BST---->C++
- Left View of a Binary Tree----> C++
- Level Order Traversal in BST ----> C++ | Java | Python
- Searching in BST ----> C++
- Lowest common ancestor in a binary tree ----> Python
- Right Side View of Binary Tree ----> C++
- Root to Leaf Path with Given Sum ----> C++
- Root to Leaf Path with Given Sum ----> Java
- Root to Leaf Path with Given Sum ----> C++ | Python
- Maiximum sum path from any node to any node in Binary Tree ----> C++ | Java
- Maximum Topology Short ----> C++
- Median of running streams of integers ----> C++
- N-ary Tree ----> Python
- Printing all elements in given range in BST ----> C++
- Red Black Tree (Insertion and Deletion operation) ----> Java
- Right Side View of Binary Tree ----> C++ | Java
- Spiral Traversal of Binary Tree ----> C++
- Distance between two nodes of a binary tree ----> C++
- Searching in BST ----> C++ | Java
- Threaded Tree ----> C++
- Top-View of a Binary tree ----> C++