Algorithms
  • Introduction
  • Algorithms
    • Insertion Sort
    • Shell Sort
    • Selection Sort
    • Heap Sort
    • Merge Sort
    • Quick Sort
    • Dual Pivot QuickSort
    • Radix Exchange Sort
  • Data Structures
    • Basic Datastructures
      • Table or Array
      • List
      • Linked List
      • Stack
      • Queue
      • Deque
      • Dictionary
      • HashTables
    • Trees
      • Tree
      • Binary Search Tree
      • Heap
      • Red-Black Trees
      • Splay Trees
      • Randomized Search Trees
    • Dynamic Programming
      • Fibonacci
      • Knapsack
      • Optimal Binary Search Trees
      • Longest Common Sub sequence
    • External Data Structures
      • B-Trees
      • Variants
    • Multi-dimensional Data Structures
      • Point-Region Quadtree
      • Point-Quadtrees
    • Priority Queues
      • Binomial Queues
  • Graphs
    • Basics
    • Depth First Search
    • Applications of Depth First Search
    • Breadth First Search
    • Shortest Paths
    • Transitive Closure
    • Flow Networks
    • Matching
  • Strings
    • Data Structures for Strings
      • Tries
        • Binary Tries
        • Multiway Trie
        • Patricia Tries
      • Variable Length-code
        • Elias Code
        • Gamma Code
        • Fibonacci Code
      • Huffmancode
      • Ternary Search Tree
    • Searching in Strings
      • Prefix Function
      • Knuth-Morris-Pratt
      • Boyer-Moore
      • Monte-Carlo Algorithms
      • Karp-Rabin
      • Automatons
      • Shift-AND
    • Indexing Text
      • Suffix Trees
      • Suffix Arrays
      • Search Engines & Inverted Files
  • P and NP
    • Introduction
    • SAT and 3-SAT
    • Graph Problems
    • Problems with Collections
    • Networks
    • Data storage
  • Metaheuristics
    • Trajectory Methods
      • Local Search
      • Simulated Annealing
      • Tabu Search
    • Population Based
      • Ant Colony
      • Evolutionary Computation
  • Sources
Powered by GitBook
On this page
  • Operations
  • Level-order traversal
  • Pre-order traversal
  • In-order traversal
  • Post-order traversal

Was this helpful?

  1. Data Structures
  2. Trees

Tree

PreviousTreesNextBinary Search Tree

Last updated 6 years ago

Was this helpful?

  • A tree is a datastructure representing nodes connected by edges

  • Each node can have a maximum of 2 children

  • The path is the sequence of one node to the other

  • A leaf is a node without children

Operations

  • Insertion

  • Search

Level-order traversal

  • Level order starts at the root and goes from top to bottom from left to right

Pre-order traversal

  • first root node, then left subtree, then right subtree

In-order traversal

  • The output will produce sorted key values in ascending order

  • First left subtree, then root, then right subtree

Post-order traversal

  • First left subtree, then right subtree, then root

https://www.tutorialspoint.com/data_structures_algorithms/tree_data_structure.htm
https://www.tutorialspoint.com/data_structures_algorithms/tree_traversal.htm