Top Banner
1 Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts Assist.Prof.Dr. Nükhet ÖZBEK Ege University Department of Electrical & Electronics Engineering [email protected]
56

CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

Jun 11, 2018

Download

Documents

buiduong
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

1

Introduction to Computing

Lecture 00: Part 2 Introduction to Algorithms and

Flowcharts

Assist.Prof.Dr. Nükhet ÖZBEK

Ege University

Department of Electrical & Electronics Engineering

[email protected]

Page 2: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

2

Topics

• Solving problems

• Software Development Method

• Algorithms

• Flow Charts

Page 3: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

3

Software Development

• Programming is a problem-solving activity

Page 4: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

4

How do we solve problems? • We "just do"

• Guesswork-and-luck

• Trial-and-error

• Experience (possibly someone else's)

• "Scientifically"

Page 5: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

5

The Problem-solving Process

Requirement Analysis

Analysis

Design

Implementation

Test and Verification

Maintenance

Page 6: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

6

Requirement analysis

• Formally specify the problem and the needed solution

• Unimportant aspects are removed from problem definition

Page 7: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

7

Analysis

• Detailed identification of the problem and the desired solution

• Detailed specification of input data and the required output is worked out

Page 8: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

8

Design

• Specification of the process(es) needed to transform the input to the desired output

• Sequence of instructions specifying the steps required to accomplish a task is called an algorithm

• Designed algorithm must be checked for correctness

Page 9: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

9

Implementation

• Designed algorithm is translated into a chosen computer language

Page 10: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

10

Test and verification

• To see that developed program works as intended

• Program must be run with several different data sets to verify the program

Page 11: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

11

Maintenance

• Developed program is modified to correct unexpected errors encountered in the program and add new features to the program if needed

• Maintenance can be a tedious process

– Programs must be well documented and structured

Page 12: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

12

• A sequence of instructions specifying the steps required to accomplish some task

• Named after:

Muhammad ibn Musa al-Khwarizmi

of Khowarezm (now Khiva in Uzbekistan)

Algorithm

Page 13: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

13

• A sequence of instructions describing how to do a task

Algorithm – Working Definition

[As opposed to actually executing

the instructions]

Page 14: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

14

Algorithm -- Examples

• A cooking recipe

• Assembly instructions for a model

• The rules of how to play a game

• Directions for driving from A to B

• A knitting pattern

• A car repair manual

Page 15: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

15

Components of an Algorithm

• Variables and values

• Instructions

• Sequences

• Procedures

• Selections

• Repetitions

• Documentation

Page 16: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

16

Values

• Represent quantities, amounts or measurements

• May be numerical or alphabetical (or other things)

• Often have a unit related to their purpose

• Example:

– Recipe ingredients

Page 17: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

17

Variables

This jar

can contain

10 cookies

50 grams of sugar

3 slices of cake

etc.

Values Variable

• Are containers for values – places to store

values

• Example:

Page 18: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

18

Restrictions on Variables

• Variables may be restricted to contain a specific type of value

Page 19: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

19

Instructions – Examples

• Take off your shoes

• Count to 10

• Cut along dotted line

Directions to perform

specific actions on values

and variables.

Page 20: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

20

Sequence -- Example

1. Open freezer door

2. Take out Gourmet Meal™

3. Close freezer door

4. Open microwave door

5. Put Gourmet Meal™ on carousel

6. Shut microwave door

7. Set microwave on high for 5 minutes

8. Start microwave

9. Wait 5 minutes

10. Open microwave door

11. Remove Gourmet Meal™

12. Close microwave door

Page 21: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

21

Components of an Algorithm

Values and Variables

Instruction (a.k.a. primitives)

Sequence (of instructions)

• Procedure (involving instructions)

• Selection (between instructions)

• Repetition (of instructions)

• Documentation (beside instructions)

Page 22: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

22

Procedure

• A named sequence of instructions

• So that you can

– Refer to it collectively (by name)

– ...instead of individually (by each instruction in the sequence)

• Example:

– Drive_To_Uni

Page 23: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

23

Procedure -- Example procedure Drive_To_Uni

{

1. find car keys

2. disable car alarm

3. open car door

4. get in car

5. shut car door

6. put keys in ignition

7. start car

8. back car out of driveway

9. drive to end of street

10. turn right

11. drive to end of street

12. turn left

...etc...etc...etc

...etc...etc...etc...

52. find parking space

53. pull into parking

space

54. turn off engine

55. remove keys from

ignition

56. open car door

57. get out

58. shut car door

59. lock car door

60. enable alarm

}

Page 24: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

24

Procedure – Example (cont)

procedure Do_Thursday

{

Wake_up

Have_Shower

Eat_Breakfast

Drive_To_Uni

Sit_EE134_Lecture

...etc...etc...etc...

Drive_From_Uni

...etc...etc...etc...

}

procedure Do_Week

{

Do_Monday

Do_Tuesday

Do_Wednesday

Do_Thursday

...etc...etc...etc...

}

Page 25: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

25

Procedure • A procedure may have a set of

parameters

procedure customerService ( myName ,timeOfDay )

{

say “Good timeOfDay”

say “My name is myName”

say “How can I help you?”

}

customerService ( “Ali”, “Morning” )

customerService (“Ayşe”, “Afternoon” )

customerService ( “Veli”, “Night” )

Page 26: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

26

Procedure – Example (cont)

procedure Do_Thursday

{

Wake_up

Have_Shower

Eat_Breakfast

Drive_To_Uni

Sit_EE134_Lecture

...etc...etc...etc...

Drive_From_Uni

...etc...etc...etc...

}

An instruction invoking a procedure is known as a “procedure call”

Page 27: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

27

Procedure – Example (cont)

procedure Do_Thursday

{

Wake_up

Have_Shower

Eat_Breakfast

Drive_To_Uni

Sit_EE134_Lecture

...etc...etc...etc...

Drive_From_Uni

...etc...etc...etc...

}

We use brackets to mark the beginning and end of a sequence.

Page 28: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

28

Procedure – Example (cont)

procedure Do_Thursday

{

Wake_up

Have_Shower

Eat_Breakfast

Drive_To_Uni

Sit_EE134_Lecture

...etc...etc...etc...

Drive_From_Uni

...etc...etc...etc...

}

In this subject, we also use the following words to refer to a “Procedure” :

• Sub-routine

• Module

• Function

Page 29: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

29

Components of an Algorithm

Values and Variables

Instruction (a.k.a. primitives)

Sequence (of instructions)

Procedure (involving instructions)

• Selection (between instructions)

• Repetition (of instructions)

• Documentation (beside instructions)

Page 30: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

30

Selection

• An instruction that decides which of two possible sequences is executed

• The decision is based on a single true/false condition

Page 31: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

31

Selection Example - Car Repair

if (motor turns)

then

{

CheckFuel

CheckSparkPlugs

CheckCarburettor

}

else

{

CheckDistributor

CheckIgnitionCoil

}

Page 32: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

32

Selection Example – Car Repair (cont)

if (motor turns)

then

{

CheckFuel

CheckSparkPlugs

CheckCarburettor

}

else

{

CheckDistributor

CheckIgnitionCoil

}

Should be a

true or false

condition.

Page 33: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

33

Selection Example -- Car Repair (cont)

if (motor turns)

then

{

CheckFuel

CheckSparkPlugs

CheckCarburettor

}

else

{

CheckDistributor

CheckIgnitionCoil

}

Sequence if

the condition

is true.

Page 34: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

34

Selection Example -- Car Repair (cont)

if (motor turns)

then

{

CheckFuel

CheckSparkPlugs

CheckCarburettor

}

else

{

CheckDistributor

CheckIgnitionCoil

}

Sequence if the

condition is

false.

Page 35: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

35

Selection – Several Conditions

• What if several conditions need to be satisfied? if ( today is Thursday and the time is 10.00am )

then

{

Go to EE134 Lecture

}

else

{

Go to Library

} Solution 1

Page 36: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

36

Selection – Several Conditions (cont)

Solution 2

Often called a

“nested selection”

if ( today is Thursday ) then { if ( the time is 10.00am ) then { Go to EE134 Lecture } } else ...etc...etc...etc...

Page 37: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

37

Selection – At Least One of Several Conditions

• What if at least one of several conditions needs to be satisfied?

if ( I feel hungry or the time is 1.00pm

or my mate has his eye on my lunch

)

then

{

Eat my lunch now

}

Page 38: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

38

Selection – Several Courses of Action

• What if there are several courses of action?

if ( button pressed is 1 )

then

{

CheckAccountBalance

}

else

{

if ( button pressed is 2 )

then

{

TransferFunds

}

else

{

if ( button pressed is 3 )

then

{

PayBills

}

else

{

if ( button pressed is 4 )

then

{

ExitPhoneBanking

}

else

{

say “Invalid option”

}

}

}

} Form 1

Page 39: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

39

Selection – Several Courses of Action (cont)

if ( button pressed is 1 )

then

{

CheckAccountBalance

}

else if ( button pressed is 2 )

then

{

TransferFunds

}

else if ( button pressed is 3 )

then

{

PayBills

}

else if ( button pressed is 4 )

then

{

ExitPhoneBanking

}

else

{

say “Invalid option”

}

Form 2 “Cascaded”

selection.

Page 40: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

40

Components of an Algorithm

Values and Variables

Instruction (a.k.a. primitives)

Sequence (of instructions)

Procedure (involving instructions)

Selection (between instructions)

• Repetition (of instructions)

• Documentation (beside instructions)

Page 41: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

41

Repetition

• Repeat an instruction...

– ...while (or maybe until) some true or false condition occurs

– Test the condition each time before repeating the instruction

• Also known as iteration or loop

• Example:

– Algorithm for getting a date

Page 42: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

42

Repetition -- Example

procedure AskOnDate ( name, time, location )

{

Phone(name)

Say("Hey", name, "it's your lucky day!")

Say("Wanna come to", location, "at", time, "?")

ListenToReply ( )

start begging count at zero

while (reply is "No" and begging count < 100)

{

Say("Oh please!")

add 1 to begging count

ListenToReply ( )

}

}

Page 43: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

43

Repetition – Example (cont)

procedure AskOnDate ( name, time, location )

{

Phone(name)

Say("Hey", name, "it's your lucky day!")

Say("Wanna come to", location, "at", time, "?")

ListenToReply ( ) start begging count at zero while ( reply is "No" and begging count < 100 ) { Say("Oh please!")

add 1 to begging count

ListenToReply ( )

}

}

Condition is tested

before sequence

Page 44: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

44

Repetition – Example (cont)

procedure AskOnDate ( name, time, location )

{

Phone(name)

Say("Hey", name, "it's your lucky day!")

Say("Wanna come to", location, "at", time, "?")

ListenToReply ( ) start begging count at zero while (reply is "No" and begging count < 100) { Say("Oh please!")

add 1 to begging count

ListenToReply ( ) }

}

Sequence may not

get executed at all

Page 45: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

45

Repetition – Example (cont)

procedure AskOnDate ( name, time, location )

{

Phone(name)

Say("Hey", name, "it's your lucky day!")

Say("Wanna come to", location, "at", time, "?")

ListenToReply ( ) start begging count at zero while (reply is "No" and begging count < 100) { Say("Oh please!")

add 1 to begging count ListenToReply ( )

}

}

Ensure initial

values of variables

used in the

conditions are set

correctly

Page 46: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

46

Repetition – Example (cont)

procedure AskOnDate ( name, time, location )

{

Phone(name)

Say("Hey", name, "it's your lucky day!")

Say("Wanna come to", location, "at", time, "?")

ListenToReply ( ) start begging count at zero while (reply is "No" and begging count < 100) { Say("Oh please!")

add 1 to begging count ListenToReply ( )

}

}

Ensure the variables

used in the conditions

are updated in each

iteration

Page 47: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

47

Repetition – Example (cont)

procedure AskOnDate ( name, time, location )

{

Phone(name)

Say("Hey", name, "it's your lucky day!")

Say("Wanna come to", location, "at", time, "?")

ListenToReply ( )

start begging count at zero

while (reply is "No" and begging count < 100)

{

Say("Oh please!")

}

} Infinite loop

• What if we don’t increment the begging count?

Page 48: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

48

Repetition – Variation

decide on Time and Location

initialise booking to “unsuccessful”

while ( not successfully booked )

{

get next Name in little black book

AskOnDate(Name, Time, Location)

DetermineBookingSuccess

}

SighWithRelief

Page 49: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

49

Repetition – Pre-tested Loop

decide on Time and Location

initialise booking to “unsuccessful”

while ( not successfully booked )

{

get next Name in little black book

AskOnDate(Name, Time, Location)

DetermineBookingSuccess

}

SighWithRelief pre-tested loop

Page 50: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

50

Repetition – Pre-tested Loop

decide on Time and Location

initialise booking to “unsuccessful”

until ( successfully booked )

{

get next Name in little black book

AskOnDate(Name, Time, Location)

DetermineBookingSuccess

}

SighWithRelief pre-tested loop

Page 51: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

51

Repetition – Post-tested Loop

decide on Time and Location

initialise booking to “unsuccessful”

do

{

get next Name in little black book

AskOnDate(Name, Time, Location)

DetermineBookingSuccess

} while ( not successfully booked )

SighWithRelief post-tested loop

Sequence is

executed at

least once

Page 52: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

52

Repetition – Post-tested Loop

decide on Time and Location

initialise booking to “unsuccessful”

repeat

{

get next Name in little black book

AskOnDate(Name, Time, Location)

DetermineBookingSuccess

} until ( successfully booked )

SighWithRelief

Page 53: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

53

Repetition -- Variations

decide on Time and Location

initialise booking to “unsuccessful”

loop

{

get next Name in little black book

AskOnDate(Name, Time, Location)

DetermineBookingSuccess

if ( successfully booked )

then

{

break loop

}

}

SighWithRelief

Page 54: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

54

Components of an Algorithm

Values and Variables

Instruction (a.k.a. primitives)

Sequence (of instructions)

Procedure (involving instructions)

Selection (between instructions)

Repetition (of instructions)

• Documentation (beside instructions)

Page 55: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

55

Documentation

• Records what the algorithm does

• Describes how it does it

• Explains the purpose of each component of the algorithm

• Notes restrictions or expectations

• Example:

– Getting a date (again)

Page 56: CE131: Introduction to Algorithms - egec.yolasite.com · Introduction to Computing Lecture 00: Part 2 Introduction to Algorithms and Flowcharts ... •Algorithms •Flow Charts .

56

Documentation -- Example

Think of something romantic to do decide on time and location

Work through address book to look for a person initialise booking to “unsuccessful”

until (successfully booked)

{

get next Name in little black book

AskOnDate(Name, Time, Location)

DetermineBookingSuccess

}

Assumes that I will find someone in the book before it runs out

SighWithRelief