Presentation is loading. Please wait.

Presentation is loading. Please wait.

Algorithms 1 (Lecture 2 of CSE1301)

Similar presentations


Presentation on theme: "Algorithms 1 (Lecture 2 of CSE1301)"— Presentation transcript:

1 Algorithms 1 (Lecture 2 of CSE1301)
Dr Damian Conway Room 132, Building 26 (Consult hours on the door)

2 Notice Thursday 9am-12pm prac in G13 has been moved to 10am-1pm in the same room. ALLOCATE+ will continue to show 9am, but it actually starts at 10am. If you need to be in the prac (e.g. Sci/Eng students), allocate yourself into the 9am G13 prac, but turn up at 10am.

3 Topics Solving problems Algorithms Values and variables

4 The Problem-solving Process
How do we solve problems? We "just do". Guesswork-and-luck Trial-and-error Experience (possibly someone else's) "Scientifically"

5 The Problem-solving Process
"Doctor, my head hurts" Analysis Patient has elevated pressure in anterior parietal lobe. Problem specification Design 1. Sterilize cranial saw 2. Anaesthetize patient 3. Remove top of skull 4. Get the big spoon... 5. etc., etc. Algorithm Implementation sterilize(saw, alcohol); raise_hammer(); lower hammer(fast); start(saw); /* etc. etc. */ Program Compilation Executable (solution)

6 Algorithm A set of instructions specifying the steps required to accomplish some task

7 Algorithm Named after: Muhammad ibn Musa al-Khwarizmi
circa AH ( CE) Wrote books on arithmetic (especially decimal numbers) and algebra

8 Algorithm Named after: Muhammad ibn Musa al-Khwarizmi

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

10 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

11 Algorithm Examples: Arroz con pollo Almond and honey slice

12 Components of an algorithm
Variables and values Instructions Sequences Procedures Selections Repetitions

13 Values Represent quantities, amounts, or measurements
May be numerical or alphabetic (or other more mysterious things) Often has a unit related to their purpose Examples: Recipe ingredients Hardware requirements

14 Variables Are containers for values
Places to store values when we're not using them. May be restricted to containing a specific type of value (i.e. only stores integers) Examples: Little black book Cricket team

15 Reading Deitel & Deitel, C: How to program
Chapter 1, Sections 1.1 to 1.10 Chapter 3, Sections 3.1 to 3.3


Download ppt "Algorithms 1 (Lecture 2 of CSE1301)"

Similar presentations


Ads by Google