CSE 214 Study Guide - Final Guide: Merge Sort, Bubble Sort, Insertion Sort

95 views2 pages

Document Summary

Cse 214: study guide types, merge, and quick. Selection sort always performs poorly, even on a sequence of sorted keys! Insertion sort performs much better if the keys are sorted or nearly sorted. Bubble sort performs better on special cases. Not good sorts to use because of time complexity. Divide the elements to be sorted into two groups of equal size. Combine the two sorted groups into one large sorted list. Takes an array and splits it in half. Then for each side of the split array, those are split in half. This continues until each part only has one element inside of it. 2 of those small parts and sorts them. This continues back up until the entire array is sorted. This is done by recursion useful and quick. Then it places the rest of the elements based on whichever is smaller: [1,1,2,2,5,12,15,71] sort combines the last 2 arrays into 1.