Algorithms

Computer Programming: Key Concepts

Algorithms

What are they?

A repeatable process for determining the solution to a problem.

Movie Algorithm

function transportationOptions() {
  // Write code here to make this decision tree into an algorithm!
}
          

Algorithms in Daily Life

  • Finding a fruit in the grocery store.
  • Alphabetizing name tags.
  • Re-organizing your kitchen to make finding stuff easier.
  • Finding keys that you lost.
  • Finding something good to watch on TV.
  • Washing your car windows.

These are all things that we can repeat over and over again!

Create your own algorithm

Design an algorithm for doing the laundry.

How to think about algorithms

Algorithms, Pseudocode, and how to make solving problems more efficient

More on Algorithms: Your Brain and Your Computer

Click here for more info on different types of algorithms as well as linear and binary search

Click here for more on binary search!

Problem-Solving Method

  1. Understand the problem.
    • Read or listen to the problem statement.
    • What is the input?
    • What is the output?
  2. Make a plan to solve the problem.
    • Use pictures, charts, graphs, systematic lists, objects.
    • Act out the solution to help you devise a plan.
    • In Computer Science, we call this plan an algorithm.
  3. Carry out the plan.
    • Once the plan is conceived and understood, follow it.
    • If you have planned well, this is the easy part.
  4. Review and reflect on how the problem was solved — once the problem is solved, reflect on the plan that was used.

The Importance of Pseudocoding

To pseudocode is to write out the steps of solving a problem in plain language (before you start writing any code).

One Step At A Time

More on Pseudocoding

Watch this!

Pseudocoding Steps

  1. Make sure you fully understand the problem.
  2. Look up any tools you might need.
  3. Write down the inputs and outputs of the function.
  4. List out the coding structures you might use (loops, variables, conditional statements).
  5. Write comments describing what you are going to do.
  6. Look it over and then write the code!

Exercise!

Flex your algorithm muscles!

Coding Dojo logo
Exercise Gif Trello Logo

THE END

Thank you for your attention!