Answers | 100% Correct | A+ Graded
(2026–2027)
3 algorithm properties - Answer- unambiguous (clear meaning)
executable (can be performed)
terminating (has a finite runtime)
left(v) index? - Answer- 2i + 1
right(v) index? - Answer- 2i+2
parent index? - Answer- floor[(i-1)/2]
pre order traversal: - Answer- visit the node before its children
post order traversal: - Answer- visit the children before you visit the node
so start with leaf nodes
in order traversal - Answer- visit the parent after you've visited the left subtree, then visit
right subtree in the same way
how to delete something with 2 children in a BST? - Answer- find the next element of
the in-order traversal and replace it with that
when do we do a left rotation? - Answer- when the balancing factor is < -2
how to do a left rotation? - Answer- the parent will become part of the left subtree
when do we do a right rotation? - Answer- when the balancing factor is > 2
how to do a right rotation? - Answer- the parent becomes part of the right subtree
Where does the imbalance for a left rotation come from? - Answer- When the imbalance
comes from the right right grandchild
When do we need a right left rotation? - Answer- When the imbalance for the left
rotation comes from the right left grandchild
When do we need a left right rotation? - Answer- When the imbalance comes from the
left right grandchild