Both are data structures that consist of nodes in a parent child relationship, that have branching structures. Each node can point to more than one node.
- the single node at the top is refered to as the
ROOT - trees are nonlinear
- nodes can only point to child, every node moves away from the root node
- can only have one root
- parent node above a child
- child is a node connected to another node when moving away from the root
- siblings nodes that share the same parent
- leaf nodes with no childeren
- edge the connection between one node and another
- HTML DOM is a tree structure
- source code, looking at the various elements in the console
- Network routing
- Abstract Syntax
- Artifical Intelligence (minimax tree)
- Folders in an Operating System
- JSON view (in browser)
- trees
- binary trees, each node can have at most two childeren
- binary search trees, special case of binary tree
- sorted (usually numbers) in a particular order
- every number less than the root are to the left, greater than are to the right, this holds true for all parent childeren nodes
- many many many more than this
Classes
- node will have value, left, and right
- BST will have root
- source
- JavaScript Algorithms and Data Structures Masterclass (udemy)