Problem Solving II

# Problem Solving II - Problem Solving II George Mason...

This preview shows pages 1–9. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Problem Solving II George Mason University IT108 2 Control Structures Basic components of all algorithmic problem solutions: Sequence Process instructions one after another Selection Take an action based on a decision Repetition Repeat a set of instructions until a condition is met Sequence Structure A pseudocode and flowchart approach where the tasks/instructions are performed in a series, one after another, in the order listed The easiest problems in programming can usually be solved using only the sequence structure All the problem solving exercises you have done to this point have only required the sequence structure Only a limited number of problems can be solved using sequence structures Affords a limiting task/instruction set 4 The Sequence Structure Directs the computer to process the program instructions, one after another, in the order listed in the program Using the algorithmic design, the goal is to produce this structure using Flowcharts or Pseudocode Example: Sequence Structure Input Outp Processing Processing Items: NONE Pseudocode Algorithm: 1. Step 2. Step 3. Turn 4. Sit If we consider common movements we do with our body, sequence structures afford only a limiting instruction set such as Step, Turn Sit Sequence: Step, Step, Turn, Sit Iteration Structure A pseudocode and flowchart approach where the tasks/instructions are repeated one or more times by looping until a condition is met Example: Instead of taking a step, walking (repeated steps until you reach your destination) When the condition is met, task/repetition stops More complex problems can be solved with the aid of the iteration structure Example: Iteration & Sequence Structure Input Outp Processing Processing Items: NONE Pseudocode Algorithm: 1. Repeat 48 times Step 2. Turn 3. Sit In addition to Step, Turn, and Sit we now have the ability to Walk Sequence: Walk 48 Steps, Turn, Sit Example: Iteration/Sequence Limitation Input Outp Processing Processing Items: NONE Pseudocode Algorithm: 1. Repeat ?? times Step 2. Turn 3. Sit Can we assume that the chair is 48 steps away?...
View Full Document

## This note was uploaded on 01/26/2012 for the course IT 108, 103, taught by Professor Bruno during the Spring '11 term at George Mason.

### Page1 / 26

Problem Solving II - Problem Solving II George Mason...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online