Category Archives: Algorithms

Towers of Hanoi

Hello everyone!

I'm back, and I've got lots of exciting math to share, so let's get to it!  This week, I'd like to talk about a classic puzzle called the Towers of Hanoi.  To start, we have a board with three pegs, as shown below, one of which has a stack of disks on it.  We want to move all the disks from the starting peg to either of the other pegs.hanoi_basicHowever, we have two constraints: we can only move one disk at a time, from one peg to another, and we can never place a disk on top of a smaller disk.  So in the example below, we can move the middle disk onto the larger disk on the left, but not the smaller disk on the right.hanoi_move Continue reading Towers of Hanoi

Facebooktwitterredditpinterestlinkedinmailby feather

Algorithms

Hello everyone!

Sorry for missing last week's post.  I was a bit busy graduating.  It shouldn't happen again.

I mentioned back in my first post that one of my interests is algorithm design.  This week, I'd like to talk a bit about what that means.  The word "algorithm" gets thrown around a lot in TV shows, movies, and science journalism, and quite often, it's horribly misused.  So let's define our terms before we go further: an algorithm is a sequence of steps which can be followed to turn one form of data into another.

That's kind of an abstract definition, though, so let's dive in with an example.  Let's say we have a list of numbers, and we'd like to know which is the largest.  How might we go about this?  One way to do this is to just walk through the list and keep track of the largest number we've seen.  So in the list below, we start by saying the is the largest number.  Next, we check the and see that it's larger than , so it's the largest so far.  We then check the and see that it's even larger.  Finally, we see that the isn't larger, so is still the largest we've seen.alg_1

Continue reading Algorithms

Facebooktwitterredditpinterestlinkedinmailby feather