1/5
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is a sorting algorithm?
An algorithm that sorts elements of an array into a specific order
What are the key sorting algorithms?
- Bubble sort
- Merge sort
How does a bubble sort work?
- Items compared in pairs and swapped if they are in the wrong position
- Passes made until the list is fully ordered
What is the time complexity of a bubble sort?
O(n²) - very inefficient
How does a merge sort work?
Divide and conquer algorithm
- List is split into sub-lists until each list contains one item
- List reformed until one ordered list
What is the time complexity of a merge sort?
O(n log n)