You should be able to:
- Articulate the difference between an algorithm and a heuristic
- Explain Big O in terms of both time and space (when/how is it useful, what does it measure, etc.)
- Describe how both Bubble Sort and Merge Sort operate, as well as discuss their time/space complexities
- It classifies algorithms according to how their runtime or space requirements grow as the input size grows in the worst case scenario.
- O(n)
- O(n2)
- O(n * log(n))
- O(n!) ☑️
- O(log(n))
- O(n)
- O(n2)
- O(1) ☑️
- Bubble sort
- Merge sort ☑️
- O(n * log(n))
Top Down Approach (Recursive)
- If array is one element, good job it’s sorted!
- Otherwise, split the array and merge sort each half.
- Merge combined halves into sorted whole.
Bottom Up Approach (Iterative)
- Divide array of n elements into n arrays of 1 element.
- Merge neighboring arrays in sorted order.
- Repeat step 2 until there’s only one array.
References: