Sorting Algorithms Flashcards
What is the functionality of Selection sort
Move the smallest value to the start.
What is the functionality of bubble sort
Move the largest value to the end using pair wise comparosons and swapping
What is the functionality of Insertion Sort
The Array is virtually splitted into 2 parts, Values from the unsorted part is picked and placed at the correct position of the sorted part.
What is the functionality of Merge Sort
Merge method merges 2 sorted arrays and produce one sorted array, using the divide and conquer stradegy
What is the Time complexity of Merge Sort
N log N
What is the Time complexity of Insertion sort
log N
What is the Time complexity of Bubble sort and Selection Sort
N ^ 2
The Step by Step process of Merge Sort
- Divide the unsorted collection into 2
- Keep on dividing until the sub arrays only contain 1 element
- Merge the sub problemm solutions together.