Sorting Algorithms: The Science and Math it Relies On
Sorting Algorithms: The Science and Math it Relies On
As with any part of computer science—or science in general, or life, really—sorting algorithms rely on math, math, and more math. Of course, they also rely on some other fundamental CS concepts like for loops and recursion. Don't stress, though: you won't need to know every detail about a programming language's syntax. Why not? Because we'll be working in pseudocode.
Pseudocode
Pseudocode—code that's written for humans, not machines—is a pretty broad category, but to keep everyone on the same page, we're going to use some standard conventions when writing about sortin...
Asymptotes
Back in the day, it took computers forever to perform a calculation, but at this point we count computations in millions per second. So yeah, we don't need to worry about the runtime of an algorith...
Logarithms
Say you want to find a specific song on your computer and for some reason the search bar isn't working (we'll spare you the Windows OS joke). All you have to work with is an alphabetically sorted l...
For Loops
When Shmoop was a kid, we loved watching the family classic Paul Blart: Mall Cop. So much that when the credits rolled, we hit "Replay." Entire Saturdays were cut into hour-and-a-half long stretche...
Recursion
Your favorite video game, Mirror Maze Insanity, just released a new expansion pack (now with 20% more mirrors and a higher reflectivity ratio, whatever that means). Of course the first thing you do...
Runtime Analysis
You know the training montage in the heartwarming underdog movie where the hero goes from struggling to perform a basic task to becoming the best at sport? Some algorithms are like pre-montage-hero...
Sorting Methods
We live in a world filled with comparisons. Whether you're in the checkout line trying to pick out a pack of gum (EZ Chew has better flavor, but UChew donates a song from iTunes to an orphan for ev...