Trees Flashcards
What is the depth of a node
Path from root to node
What is the height of a node
Longest path from node to any connecting leaf
What is the depth of a tree
Longest path from root to any leaf
What is a full tree
Every node has 0 or 2 children
What is the average depth of a binary tree
sqrt(N)
What is the time complexity of insert in BST and why
O(n) because it might be unbalanced (lop-sided)
What is the rule of an AVL tree
Left and right subtrees may only differ in height by 1 max
When do you do a single and a double rotation for AVL trees
Single when imbalance is on the outside and double when inside
What are Splay trees
Every node accessed is changed to the root
What is complexity of Splay tree operation
worst cast o(n), amortized o(logn)
which splay operation is the same as which AVL operation
zig-zag = double rotation