64
1 Objectives • By the end of this lecture, students should: • understand what an algorithms is • appreciate the role of algorithm definitions in the problem solving process • know the basic components of algorithms • understand the difference between algorithms and programs • be able to formulate algorithms for simple problems Reading: Walter Savitch. An Introduction to Problem Solving and Programming, Pearson, 2004. Sec. 1.1-1.3

1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

Embed Size (px)

Citation preview

Page 1: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

1

Objectives

• By the end of this lecture, students should:• understand what an algorithms is• appreciate the role of algorithm definitions in the

problem solving process• know the basic components of algorithms• understand the difference between algorithms

and programs

• be able to formulate algorithms for simple problems

• Reading: Walter Savitch. An Introduction to Problem Solving and Programming, Pearson, 2004. Sec. 1.1-1.3

Page 2: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

2

How do we solve problems?

• We "just do"

• Guesswork-and-luck

• Trial-and-error

• Experience (possibly someone else's)

• Systematically !

Page 3: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

3

sterilize(saw,alcohol);raise_hammer();lower hammer(fast);start(saw);/* etc. etc. */

The Problem-solving Process

Problem specification

Algorithm

Program

Executable (solution)

Analysis

Design

Implementation

Compilation

"Doctor, my head hurts"

Patient has elevated pressure in anterior parietal lobe.

1. Sterilize cranial saw2. Anaesthetize patient3. Remove top of skull4. Get the big spoon...5. etc., etc.

010011101011001010101010100101010101010011001010101010100101101001110101010101001001011101001111010101011111010101000110100001101...

Page 4: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

4

Problem Idea

Algorithm Program

Informal Description Refinement

Coding

Testing & Debugging

...it’s not a linear process

Page 5: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

5

• 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)

Circa 780-850 C.E. (Common Era)

Algorithm

Page 6: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

6

Algorithm –History

Muhammad ibn Musa Al-Khwarizmihttp://www-groups.dcs.st-andrews.ac.uk/~history/Mathematicians/Al-Khwarizmi.html

• Book on arithmetic:– Hindu numeration, decimal numbers, use of zero,

method for finding square root– Latin translation (c.1120 CE): “Algoritmi de

numero Indorum”

• Book on algebra– Hisab al-jabr w’al-muqabala

Page 7: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

7

• A sequence of instructions describing how to do a task

Algorithm – Working Definition

[As opposed to actually executing

the instructions]

Page 8: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

8

Algorithm -- Examples• A cooking recipe• Assembly instructions for a model• The rules of how to play a game• VCR instructions• Description of a martial arts technique• Directions for driving from A to B• A knitting pattern• A car repair manual

Page 9: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

9

Algorithm -- Examples• A cooking recipe• Assembly instructions for a model• The rules of how to play a game• VCR instructions• Description of a martial arts technique• Directions for driving from A to B• A knitting pattern• A car repair manual

Page 10: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

10

Algorithms are not Programs• Algorithms are well-defined sequence of

unambiguous instructions• must terminate (to produce a result)• Algorithm description relies on a well-defined

“instruction language”

• Example: Manual AdditionDescribe the method!

123456+ 789001

912457

Page 11: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

11

Algorithm – Examples (cont)

• Recipe for Almond and honey slice

• Recipe for Arroz con pollo

Page 12: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

12

Almond and Honey Slice

1/2 quantity Shortcrust Pastry

185 g unsalted butter

100 g castor sugar

5 tablespoons honey

50 ml cream

50 ml brandy or any other liqueur or spirit

300 g flaked almonds

Preheat oven for 200° C

Line a 30 cm 20 cm baking tray with baking paper, and then with pastry

Bake blind for 20 minutes, then remove weights and foil

Turn oven up to 220° C.

Bring remaining ingredients to a boil, stirring.

Spread evenly over pastry.

Bake until topping is bubbling and has caramelised evenly, about 15 minutes.

Cool before cutting into fingers or squares.

From: Stephanie Alexander, The Cook’s Companion, Viking/Penguin, Ringwood, Victoria, 1996, p. 349.

Page 13: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

13

Almond and Honey Slice

1/2 quantity Shortcrust Pastry

185 g unsalted butter

100 g castor sugar

5 tablespoons honey

50 ml cream

50 ml brandy or any other liqueur or spirit

300 g flaked almonds

Preheat oven for 200° C

Line a 30 cm 20 cm baking tray with baking paper, and then with pastry

Bake blind for 20 minutes, then remove weights and foil

Turn oven up to 220° C.

Bring remaining ingredients to a boil, stirring.

Spread evenly over pastry.

Bake until topping is bubbling and has caramelised evenly, about 15 minutes.

Cool before cutting into fingers or squares.

From: Stephanie Alexander, The Cook’s Companion, Viking/Penguin, Ringwood, Victoria, 1996, p. 349.

Instructions are given in the order in which they are performed (“executed”)

Page 14: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

14

Correct Algorithm?Cut chicken into pieces and

brown the pieces on all sides in a casserole dish in hot olive oil.

Remove the chicken and to the juices in the casserole add garlic, onions and green peppers, and sauté until onion is golden.

Add bay leaf, whole tomatoes, and chicken broth.

When the broth boils add salt, saffron and rice.

Arrange chicken on rice, cover casserole and bake in a moderate oven (350°F) for 20 minutes or until the rice is tender.

Add beans and artichokes during last 10 minutes of cooking.

From: “Arroz Con Pollo” in The Margaret Fulton Cookbook, Hamlyn, Sydney, 1968.

Page 15: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

15

Cut chicken into pieces and brown the pieces on all sides in a casserole dish in hot olive oil.

Remove the chicken and to the juices in the casserole add garlic, onions and green peppers, and sauté until onion is golden.

Add bay leaf, whole tomatoes, and chicken broth.

When the broth boils add salt, saffron and rice.

Arrange chicken on rice, cover casserole and bake in a moderate oven (350°F) for 20 minutes or until the rice is tender.

Add beans and artichokes during last 10 minutes of cooking.

From: “Arroz Con Pollo” in The Margaret Fulton Cookbook, Hamlyn, Sydney, 1968.

Correct Algorithm?

Page 16: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

16

Cut chicken into pieces and brown the pieces on all sides in a casserole dish in hot olive oil.

Remove the chicken and to the juices in the casserole add garlic, onions and green peppers, and sauté until onion is golden.

Add bay leaf, whole tomatoes, and chicken broth.

When the broth boils add salt, saffron and rice.

Arrange chicken on rice, cover casserole and bake in a moderate oven (350°F) for 10 minutes.

Add beans and artichokes.

Cover, and bake for another 10 minutes or until rice is tender.

Correct Algorithm?

Page 17: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

17

From Algorithms to Programs

Problem

ProgramProgram

AlgorithmAlgorithm: A sequence of instructions describing how to do a task (or process)

Page 18: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

18

Algorithms are not Programs

• always design the algorithm before you start to program,

• the idea comes before the coding.

Page 19: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

19

Example

How to get out?

Page 20: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

20

Example

repeat

if “no wall left”

then turn left, step ahead

else if “no wall ahead”

then step ahead

else turn right

until “at exit”

“run through the maze always sticking to the wall on your left”

Page 21: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

21

Algorithms and Languages• the very same Algorithm may look very different when

described (or implemented) in different (programming-) languages, e.g.

“Sum up the numbers between 1 and 10 by adding each of them to a total starting with 0”

s +/( 10) APL-style

int s:=0; for i = 0 to 10 do s:= s+i; end Pascal-style

Page 22: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

22

Components of an Algorithm

• Input and Output Specification• Variables and values• Instructions

– Sequences– Selections– Repetitions

• Abstraction Mechanisms – Objects– Methods

Also required: Documentation

Page 23: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

23

Values

• Represent quantities, amounts or measurements

• May be numerical or alphabetical (or of some other defined “type”)

• Example:– Recipe ingredients

Page 24: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

24

Almond and Honey Slice

1/2 quantity Shortcrust Pastry

185 g unsalted butter100 g castor sugar5 tablespoons honey50 ml cream50 ml brandy or any other

liqueur or spirit300 g flaked almonds

Preheat oven for 200° C

Line a 30 cm 20 cm baking tray with baking paper, and then with pastry

Bake blind for 20 minutes, then remove weights and foil

Turn oven up to 220° C.

Bring remaining ingredients to a boil, stirring.

Spread evenly over pastry.

Bake until topping is bubbling and has caramelised evenly, about 15 minutes.

Cool before cutting into fingers or squares.

From: Stephanie Alexander, The Cook’s Companion, Viking/Penguin, Ringwood, Victoria, 1996, p. 349.

Page 25: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

25

Almond and Honey Slice

1/2 quantity Shotcrust Pastry

185 g unsalted butter

100 g castor sugar

5 tablespoons honey

50 ml cream

50 ml brandy or any other liqueur or spirit

300 g flaked almonds

Preheat oven for 200° C

Line a 30 cm 20 cm baking tray with baking paper, and then with pastry

Bake blind for 20 minutes, then remove weights and foil

Turn oven up to 220° C.

Bring remaining ingredients to a boil, stirring.

Spread evenly over pastry.

Bake until topping is bubbling and has caramelised evenly, about 15 minutes.

Cool before cutting into fingers or squares.

From: Stephanie Alexander, The Cook’s Companion, Viking/Penguin, Ringwood, Victoria, 1996, p. 349.

Page 26: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

26

Variables

This jarcan contain

10 cookies

50 grams of sugar

3 slices of cake

etc.

ValuesVariable

• Are containers for values – places to store values

• Example:

Page 27: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

27

Restrictions on Variables

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

Page 28: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

28

Components of an AlgorithmValues and Variables• Instruction (a.k.a. primitive)• Sequence (of instructions)• Selection (between instructions)• Repetition (of instructions)• Abstractions (with Objects and Methods)

• Documentation (beside instructions)

Page 29: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

29

Instructions (Primitives)

• Some action that is – simple– unambiguous– that the system knows about...– ...and should be able to actually do

Page 30: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

30

Instructions – Examples

• Take off your shoes

• Count to 10

• Cut along dotted line

• Knit 1

• Purl 2

• Pull rip-cord firmly

• Sift 10 grams of arsenic

Directions to perform specific actions on values and variables.

Page 31: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

31

Instructions -- Application

• Some instructions can only be applied to a specific type of values or variables

• Examples:

Page 32: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

32

Instructions (Primitives) -- Recommendations

• When writing an algorithm, make each instruction simple and unambiguous

• Example:

Cut chicken into pieces and brown the pieces on all sides in a casserole dish in hot olive oil.

Cut chicken into pieces.

Heat olive oil in a casserole dish.

Brown the chicken pieces in the casserole dish.

Page 33: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

33

Components of an AlgorithmValues and VariablesInstruction (a.k.a. primitive)• Sequence (of instructions)• Selection (between instructions)• Repetition (of instructions)• Abstractions (with Objects and Methods)

• Documentation (beside instructions)

Page 34: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

34

Instruction (Primitives)• When writing an algorithm, make the

instructions simple and unambiguous.

• Example:

Cut chicken into pieces and brown the pieces on all sides in a casserole dish in hot olive oil.

Cut chicken into pieces.

Heat olive oil in a casserole dish.

Brown the chicken pieces in the casserole dish.

A “sequence” of simple instructions

Page 35: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

35

Sequence

• A series of instructions

• ...to be carried out one after the other...

• ...without hesitation or question

• Example:

– How to cook a Gourmet MealTM

Page 36: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

36

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 37: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

37

Components of an AlgorithmValues and VariablesInstruction (a.k.a. primitive)Sequence (of instructions)• Selection (between instructions)• Repetition (of instructions)• Abstractions (with Objects and Methods)

• Documentation (beside instructions)

Page 38: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

38

Selection• An instruction that decides which of two

possible sequences is executed

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

• Examples:

– Car repair

– Reciprocals

Page 39: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

39

Selection Example -- Car Repairif (motor turns) then {

CheckFuelCheckSparkPlugsCheckCarburator

}else {

CheckStarterMotorCheckEngineBlock

}

Page 40: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

40

Selection Example –Car Repair (cont)

Should be a true or false condition.

if (motor turns) then {

CheckFuelCheckSparkPlugsCheckCarburator

}else {

CheckStarterMotorCheckEngineBlock

}

Page 41: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

41

Selection Example --Car Repair (cont)

Sequence if the condition is true.

if (motor turns) then {

CheckFuelCheckSparkPlugsCheckCarburator

}else {

CheckStarterMotorCheckEngineBlock

}

Page 42: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

42

Selection Example --Car Repair (cont)

Sequence if the condition is false.

if (motor turns) then {

CheckFuelCheckSparkPlugsCheckCarburator

}else {

CheckStarterMotorCheckEngineBlock

}

Page 43: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

43

Selection Example -- Reciprocals

Q. Give an algorithm for computing the reciprocal of a number.

Examples:

Reciprocal of 2: 1/2

Reciprocal of -3/4: 1/(-3/4) = -4/3

Reciprocal of 0: “undefined”

Page 44: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

44

Selection Example – Reciprocals (cont)

Q. Give an algorithm for computing the reciprocal of a number.

Algorithm: input Num if (Num is not equal 0) then { output 1/Num } else {

output "infinity" }

Page 45: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

45

Selection Example-- Reciprocals

input Num if (Num is not equal 0) then { output 1/Num } else {

output "infinity" }

Algorithm:

Num is a variable whose value depends on the actual number the user provides.

Page 46: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

46

Selection Example – Reciprocals (cont)

input Num if (Num is not equal 0) then { output 1/Num } else {

output "infinity" }

Algorithm:

Condition depends on the value of Num

Page 47: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

47

Selection Example – Reciprocals (cont)

input Num if (Num is not equal 0) then { output 1/Num } else {

output "infinity" }

Algorithm:

For a given value of Num, only one of these two sequences can be executed

Page 48: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

48

Selection Example – Reciprocals (cont)

input Num if (Num is not equal 0) then { output 1/Num } else { output "infinity"

}

Algorithm:

Executed if Num is not equal to 0

Page 49: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

49

Selection Example – Reciprocals (cont)

input Num if (Num is not equal 0) then { output 1/Num } else {

output "infinity" }

Algorithm:

Executed if Num is equal to 0

Page 50: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

50

Selection -- Exercise

input Num if (Num is not equal 0) then { output 1/Num } else {

output "infinity" }

Will the following algorithms produce the same output?

Algorithm 1: input Num

if (Num is not equal 0)

then

{

output 1/Num

}

output "infinity"

Algorithm 2:

Page 51: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

51

Selection – Several Conditions

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

then

{

Go to CSE1301 Lecture

}

else

{

Go to Library

} Solution 1

Page 52: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

52

Selection – Several Conditions (cont)

Solution 2

Often called a “nested selection”

if ( today is Wednesday ) then {

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

Page 53: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

53

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 54: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

54

Components of an AlgorithmValues and VariablesInstruction (a.k.a. primitive)Sequence (of instructions)Selection (between instructions)• Repetition (of instructions)• Abstractions (with Objects and Methods)

• Documentation (beside instructions)

Page 55: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

55

Repetition

• Repeat an instruction...– ...while (or maybe until) some condition

occurs– Test the condition each time before

repeating the instruction• Also known as iteration or loop• Example:

– Algorithm for leaving the maze

Page 56: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

56

Example

repeatif “no wall left”

then turn left, step ahead

else if “no wall ahead”then step ahead

else turn rightuntil “at exit”

“run through the maze always sticking to the wall on your left”

Danger: endless loop if termination test not correct

Page 57: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

57

Components of an AlgorithmValues and VariablesInstruction (a.k.a. primitive)Sequence (of instructions)Selection (between instructions)Repetition (of instructions)• Abstractions (with Objects and Methods)

=> Object-orientation (next lectures)• Documentation (beside instructions)

Page 58: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

58

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

Page 59: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

59

Documentation -- ExampleThink of something romantic to dodecide on time and location

Work through address book to look for a personinitialise 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 outSighWithRelief

Page 60: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

60

Components of an AlgorithmValues and VariablesInstruction (a.k.a. primitive)Sequence (of instructions)Selection (between instructions)Repetition (of instructions)• Abstractions (with Objects and Methods)

=> Object-orientation (next week)Documentation (beside instructions)

Page 61: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

61

Analysis of Algorithms

we are interested in...

• Well-definedness (otherwise it’s not an algorithm)

• Correctness (does it fulfill the specification?)

• Termination (does it always end?)

• Resource consumption (time and memory)

Page 62: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

62

Examplepicking the lightest item...

1. put first item on scale2. memorize weight3. take item from scale in hand4. repeat 5. put next item on scale6. compare to memorized weight7. take lighter item in hand; put other item away8. until no more items left

...is this well-defined?

...can we be sure that this always terminates with the correct item in hand?

Page 63: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

63

The Software Development Process

• Define the problem clearly

• Analyse the problem thoroughly

• Design an algorithm carefully

• Code the algorithm efficiently

• Test the code thoroughly

• Document the system lucidly

Page 64: 1 Objectives By the end of this lecture, students should: understand what an algorithms is appreciate the role of algorithm definitions in the problem

64

Summary• Problem Solving Process• Algorithms• Components of Algorithms

– Values and Variables– Instructions– to be continued…(with Abstractions)

• Documentation• Analysis of Algorithms