simple example algorithm for kids

In addition to my work stuff and fun stuff I also have dad stuff going on.

Part of that is homework stuff. Tonight my son had a list of math vocabulary words one of which was “algorithm” which needed an example.

After some googling, it was pretty obvious I was on my own.

Here’s what I came up with, maybe it’ll help some buddy…

Here is an algorithm for finding q in n ÷ m = q:

  1. draw m empty boxes
  2. count from 1 to n
  3. each time you count you put a dot in a box: starting from the first, then the second, etc returning to the first after you put a dot in the last box
  4. when you count up to n, the box with the smallest number of dots is q.
  5. the number of boxes with more than q dots is the remainder (r)

I gave the example of 8 ÷ 4 = q, so n = 8 and m = 4 means we need 4 empty boxes, like this:

  1. [  ][  ][  ][  ] start
  2. [. ][  ][  ][  ] count 1
  3. [. ][. ][  ][  ] count 2
  4. [. ][. ][. ][  ] count 3
  5. [. ][. ][. ][. ] count 4
  6. [..][. ][. ][. ] count 5
  7. [..][..][. ][. ] count 6
  8. [..][..][..][. ] count 7
  9. [..][..][..][..] count 8

And voilà, 8 ÷ 4 = 2

I’m sure there’s probably a better semi-trivial example, but this is the best I could come up with off the top of my head.

all that remains

I realized a while back I’d forgot to take into account remainders, so I’ve added in in to the algorithm. Here is an example as well:

Let’s try out: 8 ÷ 3 = q, so n = 8 and m = 3 :

  1. [   ][   ][   ] start
  2. [.  ][   ][   ] count 1
  3. [.  ][.  ][   ] count 2
  4. [.  ][.  ][.  ] count 3
  5. [.. ][.  ][.  ] count 4
  6. [.. ][.. ][.  ] count 5
  7. [.. ][.. ][.. ] count 6
  8. […][.. ][.. ] count 7
  9. […][…][.. ] count 8

Here we can see that the box with smallest number of dots has 2 dots, so q = 2.

Additionally, we can see that 2 boxes have 3 dots, so the remainder is 2.

Our algorithm says: 8 ÷ 3 = 2 with a remainder of 2.

Hurray!

Advertisements

4 Comments »

  1. paul said

    how did u get 7

  2. brianin3d said

    Uhmmm… that’s actually a really good question! Changed it to say “8”…

  3. AyeshaAU said

    I need help in computer algorithm 😦

  4. brianin3d said

    What do you mean? You have an computer algorithm you need help with or you want a simple example of a computer algorithm or something else?

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: