Sorting Flashcards
1
Q
What two things are taken into consideration when determining the complexity of a sort?
A
- ) traversals
2. )comparisons
2
Q
What two parts do the insertion and selection consist of?
A
unsorted & sorted
3
Q
What is the procedure for a selection sort?
A
- traverse to find the next value in the sorted part
- swap this value with the first unsorted value
- this new index is now the sorted part
4
Q
What is the procedure for an insertion sort?
A
- take first value in the unsorted
- traverse through the sorted and insert at that point
- mark that as sorted
5
Q
What is the worst time complexity of the insertion and selection sort?
A
O(N^2)
6
Q
What is the complexity of the merge sort?
A
O(N*log N)