This page is a work in progress.You can help improve it. →

Hello, Algorithms!

Welcome to your journey as a developer. One of the core tasks a devloper does is generate algorithms. In this assignment we'll practice breaking down problem statements into algorithms.

Objectives

  • Begin working with algorithmic thinking

Requirements

Write your answers in a text file on your computer. If you have Visual Studio Code installed, feel free to use it. Otherwise use Notepad or TextEdit.

Language

In the following problems you will write individual English statement steps. Try to be as specific and precise as you can.

For example, if we were writing an algorithm for finding the total value of coins in our pocket we might write something like this:

  1. Start our counter out at zero (0) cents
  2. Place your hand in your pocket, and attempt to remove a single coin.
  3. If you cannot remove a coin, then announce the current counter total and STOP
  4. If the coin you removed is a penny, add one to your total, place the coin on the table, and return to step 2
  5. If the coin you removed is a nickle, add five to your total, place the coin on the table, and return to step 2
  6. If the coin you removed is a dime, add ten to your total, place the coin on the table, and return to step 2
  7. If the coin you removed is a quarter, add 25 to your total, place the coin on the table, and return to step 2
  8. If the coin you removed is a half-dollar, add 50 to your total, place the coin on the table, and return to step 2
  9. If the coin you removed is a dollar, add 100 to your total, place the coin on the table, and return to step 2
  10. If the coin you removed is anything else, don't add anything to your total, place the coin on the table, and return to step 2

NOTE: This isn't the only way to write this algorithm and each of you would have your own way of thinking about this example and the challenges below. That many algorithms exist for the same problem is both a joy and frustration when it comes to computing. It represents the fact that this is both a science, and an art (since it requires creativity)

Explorer Mode

  • Write an algorithm for making a Peanut Butter and Jelly sandwich. Assume the person making the sandwich is a robot (or an alien) and needs the most detailed instructions you've ever seen. To see an example of how picky this robot/alien is, view this video of a parent trying this with children: https://www.youtube.com/watch?v=cDA3_5982h8)

  • Write an algorithm for how you brush your teeth. Consider if you use a manual or electric toothbrush. What kind of toothpaste do you use? How do you squeeze it from the tube? What kind of motion do you use? What order do you use? Be as SPECIFIC as you can (and make your dentist proud!)

  • Write an algorithm for wrapping a gift. For simplicity, assume the gift is a hardback book. What approach do you use for wrapping? How much bigger than the book should the paper be? How do you place the book, etc? Please don't waste good wrapping paper on this, so feel free to use your imagination on this one.

© 2017 - 2022; Built with ♥ in St. Petersburg, Florida.