trees Flashcards
trees store items _________
hierarchically
leaf or external node
node with no children
internal node
has one or more children
depth of a node
the length of the path from that node to the root
height of a node
the length of the longest path from that node to a leaf
ways of implementing a tree
- using an array
- pointer-based
downside of array tree implementation
inefficient when it comes to locating the children of a node
array and pointer-based approach both require ________________ amount of space
asymptotically the same
trie or prefix tree
simple and practically fast data structure that implements the dictionary adts
running time for dictionary operations in a trie
O(n)
binary trees
each node has at most two children
a binary tree is full
if all internal nodes have 2 children
nL(T) =
nI(T) + 1
maximum size of a BST of size n
n-1
minimum size of a BST of size n
log(n+1)-1