Skip Top Navigation Bar

Introduction to Algorithms Lesson Plan

Overview

This lesson is meant to be used during the first week or so of a new course on Java. It is for students who have no background in computer science or in writing algorithms and programs.

Learning Objectives

Skills

Student Outcomes

Students will be able to:

Duration: 2 - 3 class periods

Resources

Warm-up / Motivate

To introduce algorithms, have students write the steps of something that they know. They need to write the steps thorough enough for another student to follow. Here are some ideas:

Follow up by identifying where in the algorithm you have written in decisions and loops.

You could have students use AI to help revise their algorithms. If you choose to include AI, ensure that you are including steps for students to critically analyze the results of using AI. Students should be careful to resist blindly following the results provided.

Learn

As a group or on their own, have students review the tutorial: Learn - Introduction to Algorithms.

Warm-up / Motivate

Supplies: Children's games, such as Candy Land, Trouble, Chutes & Ladders, Sorry!

  1. Put students into groups of 3 to 4.
  2. Have students spend 10 - 15 mintues playing the game. Ask them to pay close attention to the steps in playing the game and the decisions and repeative steps as they play.
  3. Using large post-it paper, have students write out the steps of the algorithm to playing the game. You can introduce students to the symbols used for flowcharts or they can write the algorithm using pseudocode instead.

Follow up: You can circle back to this activity to help students to continue to understand classes and objects by having them identify the objects in the game.

Learn

Students can learn about how to represent decisions and loops in their algorithms by working through the tutorial: Learn - Algorithms with Decisions and Repeation.

Additional Examples

The following represents an example of pseudocode that could be used to send a text message to a friend.

  1. Open up the text messaging app on my phone
  2. Is there a prior to text to this person at the top of the list of text messages?
    • If yes, click on the series of messages
    • If no, click on the icon to start a new message
      • Is the person in my contacts list?
        • If yes, type the person's name in the search section
          • Select the person's name from the contacts
        • If no, type in the person's phone number
  3. Type the message to the person
  4. Send the message

We can use flowchart symbols to create this same algorithm. In the flowchart, the following symbols are used:

Symbol Description
Used to start and end the algorithm.
Used to represent a single step.
Used to make a decision, with the steps to take when it is true, going to the right and the steps to take when it is false, going to the left. Also can be used for representing the decision for whether or not the statements should repeat.
Used to create a path for the algorithm to follow from one step to the next step.

The following is the flowchart representation of the algorithm written in pseudocode above.

Practice

Have students complete the practice activities: Practice - Introduction to Algorithms Practice

Wrap-up / Extend

As students are asked to write programs, it is a good practice for them to write out an algorithm prior to writing their code.

It is recommended that students share their plans with you in advance of writing their program. This allows you to provide feedback and guide thinking, especially when algorithms get more complicated. Once they have taken time to think through what they are planning to program, the amount of time writing the program will take is typically a lot less.

Often students will resist planning a program before writing it. It is more satisfying for them to just start writing program code. However, starting without thinking about the program they are writing or the problem they are trying to solve, often leads to more frustration later on. It is recommended to allow students choice and flexibility in the way they want to write their plan (pseudocode, bullet points, flowchart, other).

Next Lesson

Lesson Plan: Determining the Data Type