Final Exam Cheat Sheet
Final Exam Cheat Sheet
Final Exam Cheat Sheet
Big O look for loops. For each loop you most probably are going to
have an O(N) operation, and for nested loops that factor of N increases
A complete binary tree is a tree in which all levels are filled except the
bottom level and its members are arranged in an order from left to
right
Class inheritance:
1. Construct the base
2. Construct the data members
3. Execute the body of the constructor
Similarly,
1. Execute the body of the destructor (derived)
2. Destroy the data members
3. Destroy the base part
Insertion:
Complete the binary tree
Compare the newly added node to its parent node
If greater swap them
Deletion:
Complete the binary tree by moving the last node to the top to
complete tree
Compare to both children and swap with greater of 2
Continue to trickle down to proper place
Templates:
When a function is written, you want to declare the thing again unless
you include it in the body of the class declaration
template <class KeyType, class ValueType>
const ValueType* MyMap<KeyType, ValueType>::find(const KeyType& key)
const