Random Stuff with trees Flashcards
Removing a node from a tree
Smallest node from the right sub tree, or largest from the left sub tree
Single rotation AVL
Zig zig,
Move up middle node to be parent of the other two nodes
Double rotation
Zig zag
First make it a zig zig, then do a single rotation maneuver
if given pre and post fix expression how do you construct a tree
find head node with pre
checkc post
if its right next to the node on the left side it is a child
fill in left to right
pre and in order expressions, how to construuct tree
mark first element of preorder as root
mark root in inorder
tree is divided left and right subtrees in inorder
repeat steps
full
every node other than the leaves has two children
complete
every row is complete except for the last (balanced)
perfect
every node has two leaves, left and right subtrees have the same height
height of a tree related to nodes
2^(h+1) -1