TurboYourCode
  • Algorithms
  • Data Structures

Tree

Wikipedia

Contains nodes where each node can point to at most one parent node.

Pros Cons
Opens a new world of algorithms compared to linear data structures Operations can be linear time if using an unbalanced tree
Operations Worst Average
DeleteO(n)O(n)
InsertO(n)O(n)
SearchO(n)O(n)

Similar

Disjoint-set
Contains non-overlapping sets of elements
Trie
A k-ary search tree used for information retrieval such as autocomplete.
Treap
A probabilistic data structure that combines a heap and a binary search tree
Merkle tree
A tree used to data verification
Deque
Allows for insertion and removal from front or back of the collection.
Heap
A tree structure where all parent nodes are greater/less than children nodes for a max/min heap
Graph
Contains a set of nodes and a set of edges that the nodes point to
Graph (Adjacency list)
A graph implementation; this is useful for sparser graphs.
Graph (Adjacency matrix)
A graph implementation; this is useful for quick adjacency checks.