Unit 4: Iteration

Unit 4: Iteration

This unit focuses on iteration using while and for loops. As you saw in Unit 3, Boolean expressions are useful when a program needs to perform different operations under different conditions. Boolean expressions are also one of the main components in iteration. This unit introduces several standard algorithms that use iteration. Knowledge of standard algorithms makes solving similar problems easier, as algorithms can be modified or combined to suit new situations. Iteration is used when traversing data structures such as arrays, ArrayLists, and 2D arrays. In addition, it is a necessary component of several standard algorithms, including searching and sorting, which will be covered in later units.


ESSENTIAL QUESTIONS

Control [CON]

How does iteration improve programs and reduce the amount of program code necessary to complete a task?

What situations would warrant the use of one type of loop over another?


BIG IDEAS

+ Creating a loop to run an expression repeatedly until certain conditions are met

+ Standard arithmetic-based and String algorithms

+ Representing iterative processes in code using for and while loops

+ Nesting loop and iteration statements


UNIT TOPICS & ACTIVITIES

4.1: while Loops

4.2: for Loops

4.3: Developing Algorithms Using Strings

4.4: Nested Iteration

4.5: Informal Code Analysis


Link to Brainscapes

SKILLS ADDRESSED


Program Design and Algorithm Development

1.B: Determine code that would be used to complete code segments.

Code Logic

2.B: Determine the result or output based on statement execution order in a code segment without method calls (other than output).

2.C: Determine the result or output based on the statement execution order in a code segment containing method calls.

2.D: Determine the number of times a code segment will execute.

Code Implementation

3.C: Write program code to satisfy method specifications using expressions, conditional statements, and iterative statements.

Code Testing

4.C: Determine if two or more code segments yield equivalent results.

Documentation

5.C: Explain how the result of program code changes, given a change to the initial code.