Tree Data Structure Last Updated : 12 May, 2025 Comments Improve Suggest changes Like Article Like Report Tree Data Structure is a non-linear data structure in which a collection of elements known as nodes are connected to each other via edges such that there exists exactly one path between any two nodes.Basics of Tree Data StructureIntroduction to TreeTypes of Trees in Data StructuresApplications of tree data structureBinary TreeBinary Tree GuideApplications and Advantages of Binary TreeProperties of Binary TreeTyes of Binary TreeInorder Traversal of Binary TreePreorder Traversal of Binary TreePostorder Traversal of Binary TreeLevel Order Tree TraversalHeight or Depth of a Binary TreeHeight and Depth of NodeLevel of a Given Node in TreeSearch a Node in Binary TreeFind the Parent in Binary TreeInsertion in a Binary TreeDeletion in a Binary TreeEnumeration of Binary TreesFind all Leaf nodesBinary Tree (Array implementation)Binary Search TreeBinary Search Tree Guide Applications of BSTInsertion in Binary Search TreeSearching in Binary Search TreeBinary Search Tree (BST) Traversals – Inorder, Preorder, Post OrderDeletion in Binary Search TreeMore Problems on Binary Search TreeAVL TreeAVL Tree Data Structure Insertion in an AVL TreeDeletion in an AVL TreeWeak AVL or Rank Balanced TreesInsertion, Searching and Deletion in AVL trees containing a parent node pointerAVL with duplicate keysCount greater nodes in AVL treeHow to insert Strings into an AVL TreeMinimum number of nodes in an AVL Tree with given heightOptimal sequence for AVL tree insertion (without any rotations)Different shapes of AVL possible at height hRed-Black TreeIntroduction to Red-Black Tree Insertion in Red-Black TreeRed-Black Trees | Top-Down InsertionDeletion in Red-Black TreeApplications, Advantages, and Disadvantages of Red-Black TreeTernary Search TreeTernary Search TreeTernary Search Tree meaning & definition in DSATernary Search Tree (Deletion)How to implement text Auto-complete feature using Ternary Search TreeLongest word in ternary search treen-ary or Generic TreeGeneric Trees(N-ary Trees)What is Generic Tree or N-ary TreeDepth of an N-ary TreeChildren of a Node in an N-ary Tree Find Siblings in an N-ary TreeMirror of n-ary TreeDiameter of an N-ary TreeLevel Order Traversal of N-ary TreeSum of all elements of N-ary TreeSerialize and Deserialize an N-ary TreeB TreeIntroduction of B-TreeWhat is B-Tree? | B-Tree meaningInsert Operation in B-TreeDelete Operation in B-TreeB-Tree Insert without aggressive splittingB+ TreeIntroduction of B+ TreeWhat is B+ Tree | B+ Tree meaningInsertion in a B+ treeDeletion in B+ TreeOther types of TreesTernary Tree:What is Ternary TreeCreate a Doubly Linked List from a Ternary TreeInterval Tree:Interval TreeInterval Tree using GNU Tree-based container2-3-4 Tree:2-3-4 Tree2-3 Trees | (Search, Insert, and Deletion)Trees vs other Data StructuresDifference between graph and treeComparison between Heap and TreeWhat is the difference between Heap and Red-Black Tree?Difference between Binary Search Tree and Binary HeapDifference between Stack and TreeDifference between an array and a treeComparison among different Tree Data StructuresDifference between General tree and Binary treeDifference between Binary Tree and Binary Search TreeDifference between Binary tree and B-treeDifference between B tree and B+ treeDifference between Full and Complete Binary TreeDifference between Binary Search Tree and AVL TreeRed Black Tree vs AVL TreeProblems based on Tree Data StructureProblemsDifficulty LevelSolveHeight of Binary TreeEasySolveDetermine if two trees are identicalEasySolveMirror treeEasySolveSymmetric TreeEasySolveDiameter of treeEasySolveChecked for Balanced treeEasySolveChildren Sum ParentEasySolveCheck for BSTEasySolveArray to BSTEasySolveLargest value in each level of binary treeEasySolveMaximum GCD of siblings of a binary treeEasySolveZigzag Tree TraversalEasySolveInorder Successor in BSTEasySolveKth Largest Element in a BSTEasySolveCheck if subtreeMediumSolveSingle Valued SubtreeMediumSolveUnique BSTsMediumSolveInorder Traversal (iterative)MediumSolvePreorder Traversal (iterative)MediumSolvePostorder Traversal(iterative)MediumSolveVertical Traversal of a Binary TreeMediumSolveBoundary TraversalMediumSolveConstruct Binary Tree from Parent arrayMediumSolveConstruct Binary Tree from Preorder and Inorder TraversalMediumSolvePreorder Traversal and BSTMediumSolveConstruct tree from preorder traversalMediumSolveMinimum distance between two given nodesMediumSolveMaximum sum leaf to root pathMediumSolveOdd Even Level DifferenceMediumSolveLowest Common Ancestor of a Binary TreeMediumSolveAncestors in Binary TreeMediumSolveRemove BST keys outside the given rangeMediumSolvePair with given target in BSTMediumSolveSum TreeMediumSolveBST to greater sum treeMediumSolveBST to max heapMediumSolveClone binary tree with random pointerMediumSolveMaximum sum of non adjacent nodesMediumSolveLargest BST in a Binary TreeMediumSolveExtreme nodes in alternate orderMediumSolveConnect nodes at same levelHardSolveNodes at given distance in a Binary TreeHardSolveSorted Linked List to BSTHardSolveBinary Tree to Doubly Linked ListHardSolveMaximum sum path between two leaf nodesHardSolveK-Sum PathsHardSolveNumber of turns in a binary treeHardSolveMerge two BST’sHardSolveFixing two nodes of a BSTHardSolveBurn Binary TreeHardSolveQuick Links:Practice problems on Trees Quizzes on Tree Comment More infoAdvertise with us Next Article Tree Data Structure kartik Follow Improve Article Tags : Tree DSA Practice Tags : Tree Similar Reads DSA Tutorial - Learn Data Structures and Algorithms DSA (Data Structures and Algorithms) is the study of organizing data efficiently using data structures like arrays, stacks, and trees, paired with step-by-step procedures (or algorithms) to solve problems effectively. Data structures manage how data is stored and accessed, while algorithms focus on 7 min read Array Data Structure Guide In this article, we introduce array, implementation in different popular languages, its basic operations and commonly seen problems / interview questions. An array stores items (in case of C/C++ and Java Primitive Arrays) or their references (in case of Python, JS, Java Non-Primitive) at contiguous 4 min read String in Data Structure A string is a sequence of characters. The following facts make string an interesting data structure.Small set of elements. Unlike normal array, strings typically have smaller set of items. For example, lowercase English alphabet has only 26 characters. ASCII has only 256 characters.Strings are immut 3 min read Matrix Data Structure Matrix Data Structure is a two-dimensional array arranged in rows and columns. It is commonly used to represent mathematical matrices and is fundamental in various fields like mathematics, computer graphics, and data processing. Matrices allow for efficient storage and manipulation of data in a stru 2 min read Searching Algorithms Searching algorithms are essential tools in computer science used to locate specific items within a collection of data. In this tutorial, we are mainly going to focus upon searching in an array. When we search an item in an array, there are two most common algorithms used based on the type of input 3 min read Sorting Algorithms A Sorting Algorithm is used to rearrange a given array or list of elements in an order. For example, a given array [10, 20, 5, 2] becomes [2, 5, 10, 20] after sorting in increasing order and becomes [20, 10, 5, 2] after sorting in decreasing order. There exist different sorting algorithms for differ 3 min read Hashing in Data Structure Hashing is a technique used in data structures that efficiently stores and retrieves data in a way that allows for quick access. Hashing involves mapping data to a specific index in a hash table (an array of items) using a hash function. It enables fast retrieval of information based on its key. The 3 min read Two Pointers Technique Two pointers is really an easy and effective technique that is typically used for Two Sum in Sorted Arrays, Closest Two Sum, Three Sum, Four Sum, Trapping Rain Water and many other popular interview questions. Given a sorted array arr (sorted in ascending order) and a target, find if there exists an 11 min read Sliding Window Technique Sliding Window Technique is a method used to solve problems that involve subarray or substring or window. The main idea is to use the results of previous window to do computations for the next window. This technique is commonly used in algorithms like finding subarrays with a specific sum, finding t 13 min read Prefix Sum Array - Implementation and Applications Given an array arr[] of size n, the task is to find the prefix sum of the array. A prefix sum array is another array prefixSum[] of the same size, such that prefixSum[i] is arr[0] + arr[1] + arr[2] . . . arr[i].Examples: Input: arr[] = [10, 20, 10, 5, 15]Output: 10 30 40 45 60Explanation: For each i 8 min read Like