Basic Idea: You have a deck of unsorted cards. Lets start a sorted pile. So you take one card at a time from unsorted pile and appropriately place it in sorted pile. You keep doing it until you just left with a sorted pile.
OK, now lets break it down in high-level pseudo code. Lets assume we’re talking about arrays as a data structure.
Continue reading “Insertion Sort Explained”
Mergesort: Split data in two halfs, mergesort each half, then merge these already sorted halfs back into a single piece.
Mergesort and merge are two separate functions. Think of merge as a helper function that does most of the work. Its much easier to explain with a very high-level pseudo code:
Continue reading “Mergesort Explanation”
You might remember that a logarithm of a number is the power to which its base must be raised to produce your number. OK, that was a mouthful. Its much easier to describe with math examples. English just doesn’t cut it for things like this.
Continue reading “Logarithms Revisited”