Week 3 - Algorithms Flashcards
1
Q
How does Merge sort work?
A
It sorts smaller arrs and combine them together (merge them) on a sorted order
2
Q
What’s Merge sort’s pseudocode?
A
- Sort the left half of the arr
- Sort the right half of the arr
- Merge the two halves together
3
Q
What’s Merge sort’s O?
A
n log n
4
Q
What’s Merge sort’s Ω?
A
n log n
5
Q
How does Insertion sort work?
A
It shifts elements out of the way if necessary to make room for smaller elements