Quicksort, Mergesort,Selection sorting. Sorting Sorting is a process by which we can maintain the data list in some order We can sort this list either ascending or descending.
Type of Sorting : 1. Internal Sorting.
2. External Sorting. Sorting Bubble sort: In that sorting compression is between the two elements. These techniques are usually slow (O(n2))
But, they are easier to understand.
You will have to understand the more
complex schemes eventually. There is no escape. Insertion Sort There are two kinds of insertion sort: Insert in-order into a new list Reposition into our existing array Insertion Sort Bubble Sort Has a good name. Easy to understand. Slow and crusty. What is its efficiency? Sorts Ok, now that I’ve filled your head with the basics. Do you want to know the ultimate, mega-powered, best sort ever?
Me too. I like quicksort though.
Too many variables apply:
List contents Pre-sortedness Etc. Mergesort Mergesort takes two (or more) inputs and sorts them! But how? By insertion! Uh oh… everyone has to get up now. Quicksort The “Bad Boy” of sorts. This is recursive too. Again, everyone needs to get up. Hey…. These slides are pretty empty. But, you get to code this stuff! Sort Analysis Well, first we need to explain more structurally how these work: Mergesort: Split up a list into smaller parts (half size) until the list is of size 1. Put lists back together by “merging”: insertion sort Quicksort: Select a value and ensure that all values to the left are smaller – all values to the right are equal or larger Repeat with left/right side until they are of size 1 or 2 (and sorted).