Lesson 4: Pseudocode (January 22nd and 23rd)
Link to Lesson:
Pseudocode LessonSuggestions/Tips:
Before teaching this lesson, make sure students know what a programming language is. For mor information on this see: Programming Languages
The following examples are simplier examples than the ones in the lesson plan. It is reccomended that you use these examples to teach the studetns.
Other examples for the "Exploring Pseudocode with your Students" section include:
- Ordering people in a room from shortest to tallest
- Sorting marbles by color
Walk through the height example with the students as a class. Once you have written psuedocode for sorting the class by height, test your psuedocode as a class by following the algorithm step by step. Fix any mistakes you find along the way and hightlight the importance of checking your work when writing algorithms.
After doing the height example as a class, have the students get into small groups and try to write psuedocode for the sorting marbles problem. Give the students colored marbles (or any small colored objects) to test their psuedocode solution. Once all the groups have come up with a solution, go over the correct answer as a class
Possible pseudocode solutions for the above examples:
- Ordering people in a room from shortest to tallest:
- Place the first person at the beginning of the "ordered" line in the front of the room
- For every other person in the room:
- Compare this person's height (person A) with each other peron in the "ordered line" starting with the first person (the current shortest)
- If person A is shortert than the person they are being compared to, put person A in front of that person
- If person A is taller than the person they are being compared to, keep moving down the line and compare heights with the next person
- If person A reaches the end of the line, insert them there. This means they are the tallest so far.
- Sorting marbles by color:
- For every marble in the unsorted pile:
- Determine the color of the marble
- Look to see if there is a pile started for that color
- If a pile has been started, add the marble to that pile
- If a pile has not been started for that color, start a new pile
- For every marble in the unsorted pile:
Corresponding QuizIt Questions:
The following questions are the same questions students will see when they log into QuizIt at the end of the lesson. Because each lesson is taught over a two day period, there are two questions on QuizIt that correspond to this lesson.
These questions are shown here as a "teacher-check" to ensure that the material asked in the question has been covered in the lesson. Please do not go over the answer to this question during the lesson. We want to see if the students can apply what they learned in class to answer this question.
1. Which of the following is NOT true about pseudocode? (the correct answer is bolded)
- It is informal
- It is a high-level description of the operating procedure of a computer program or algorithm
- It is intended for human reading rather than machine reading
- It uses words and symbols that only the computer can understand
2. What are the benefits of writing pseudocode?
- It allows you to see a pattern, make abstractions, and design a solution
- Writing pseudocode makes it easier to, afterwards, translate it into a programming language
- You don't need to know a programming language to write pseudocode
- All of these are benefits
Additional Practice Questions:
Feel free to go over these questions in class as an "end of lesson review"
What is a programming language?
- A vocabulary and set of rules for instructing a computer or computing device to perform specific tasks
- Part of a program that does not work correctly
- Observing patterns, trends, and regularieites in data
- Processing smaller tasks from a larger task, all at the same time, to more efficiently reach a common goal