Skip to content

Latest commit

 

History

History
81 lines (65 loc) · 5.39 KB

readme.md

File metadata and controls

81 lines (65 loc) · 5.39 KB

Trees

Theory

Trees

  • A tree is a nonlinear data structure, compared to arrays, linked lists, stacks and queues which are linear data structures.

  • A tree can be empty with no nodes or a tree is a structure consisting of one node called the root and zero or one or more subtrees.

  • A tree can be defined recursively as a collection of nodes (starting at a root node), where each node is a data structure consisting of a value, together with a list of references to nodes (the "children"), with the constraints that no reference is duplicated, and none points to the root.

Trees Applications

  • Manipulate hierarchical data.
  • Make information easy to search (see tree traversal).
  • Manipulate sorted lists of data.
  • As a workflow for compositing digital images for visual effects.
  • Router algorithms
  • Form of a multi-stage decision-making (see business chess).
  • Compilers
  • File system
  • Data compression
  • Digital signature algorithm
  • Heap
  • Network routing protocol
  • Abstract syntax tree
  • Document Object Model
  • Decision tree learning
  • Minimax tree
  • Expectiminimax tree
  • Monte Carlo tree search
  • Min-max tree
  • Min-max heap
  • Suffix tree
  • Suffix array
  • B+ tree, B-tree, and B*-tree
  • Red-black tree
  • AVL tree
  • Splay tree
  • Treap
  • T-tree
  • AA tree
  • Scapegoat tree, etc.

Trees Implementation

  • Using a struct.

Trees Time Complexity

  • Access: O(n)
  • Search: O(n)
  • Insertion: O(1)
  • Deletion: O(1)

Trees Space Complexity

  • O(n)

Problems

Category: Trees Status: In Progress Author: David Bujosa