A bubble sort is a simple sorting algorithm that works by seeing if the adjacent values are larger/smaller than the selected value, and swapping them accordingly
- Is the selected value a higher number than the value next to it?
- If it is a larger value, they will swap
- This repeats across the next pair of numbers until the end of the array
- This is a complete bubble sort
- Passes will be made until they are no longer needed
Merge Sort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves. The merge() function is used for merging two halves. The merge is key process that assumes that array and array are sorted and merges the two sorted sub-arrays into one.
- Splitting
- The first list will be halved into two new lists
- This is repeated until all lists have a single value
- Merging
- The smallest items from adjacent lists are compared
- Whichever is smaller goes into a new merged list first
- This is repeated until a new list is formed from all of the split lists
- One fully sorted merged list should remain

