Docsity

Assignment 1 - Recipes as Algorithms | CS 261, Assignments of Data Structures and Algorithms

Toggle sidebar
bg1
Worksheet 1: Recipes as Algorithms Name:
An Active Learning approach to Data Structures using C
1
Worksheet 1: Recipes as Algorithms
In preparation: Read Chapter 2 on algorithms.
As you learned in Chapter 2, an algorithm is a description of how a specific problem can
be solved, written at a level of detail that it can be reused. An algorithm is used to solve a
general class of similar problems. Terms that have a related meaning include process,
routine, technique, procedure, pattern, and recipe.
A type of algorithm that most people have seen is a recipe, such as the following:
Lemon Soufflè
Ingredients
1 envelope unflavored gelatin
1/4 cup cold water
6 egg yolks
1 cup sugar
2/3 cup lemon juice
1 tablespoon grated lemon rind
4 egg whites
1 and 1/2 cup heavy cream
Actions
1. Soften the gelatin in water. Beat egg
yokes and sugar until thick and light. Stir in
lemon juice and cook over low heat, beating
steadily with a whisk until thickened and hot
but not boiling (10--15 minutes).
2. Pour mixture into large bowl, mix in
gelatin until dissolved, and then add lemon
rind. Stir occasionally until cool.
3. Beat egg whites until stiff but not dry.
Fold into lemon mixture, then whip the
cream and fold in. Pour into a two-quart
soufflè dish (or large bowl) and refrigerate at
least 12 hours.
Working with your neighbors or in a group, critique the description of the recipe using
the categories given in chapter 2. (These are printed on the back side). Do you think you
would be able to correctly produce the desired result given this description? Write your
comments in the space provided.
pf2

Partial preview of the text

Download Assignment 1 - Recipes as Algorithms | CS 261 and more Assignments Data Structures and Algorithms in PDF only on Docsity!

Worksheet 1: Recipes as Algorithms Name:

An Active Learning approach to Data Structures using C 1

Worksheet 1: Recipes as Algorithms

In preparation : Read Chapter 2 on algorithms. As you learned in Chapter 2, an algorithm is a description of how a specific problem can be solved, written at a level of detail that it can be reused. An algorithm is used to solve a general class of similar problems. Terms that have a related meaning include process, routine, technique, procedure, pattern, and recipe. A type of algorithm that most people have seen is a recipe, such as the following: Lemon Soufflè Ingredients 1 envelope unflavored gelatin 1/4 cup cold water 6 egg yolks 1 cup sugar 2/3 cup lemon juice 1 tablespoon grated lemon rind 4 egg whites 1 and 1/2 cup heavy cream Actions

  1. Soften the gelatin in water. Beat egg yokes and sugar until thick and light. Stir in lemon juice and cook over low heat, beating steadily with a whisk until thickened and hot but not boiling (10--15 minutes).
  2. Pour mixture into large bowl, mix in gelatin until dissolved, and then add lemon rind. Stir occasionally until cool.
  3. Beat egg whites until stiff but not dry. Fold into lemon mixture, then whip the cream and fold in. Pour into a two-quart soufflè dish (or large bowl) and refrigerate at least 12 hours. Working with your neighbors or in a group, critique the description of the recipe using the categories given in chapter 2. (These are printed on the back side). Do you think you would be able to correctly produce the desired result given this description? Write your comments in the space provided.

Worksheet 1: Recipes as Algorithms Name:

An Active Learning approach to Data Structures using C 2

Input: Result: Correctness: Time to execute: Instruction Precision: