Al-Khwarizmi 2 (Lecture 3 of CSE1301) Dr Damian Conway Room 132, Building 26 (Consult hours on the door)

Slides:



Advertisements
Similar presentations
Introduction to Programming
Advertisements

Mrs. Murphy General Chemistry Room 814
Advanced Database Projects In Access © Hodder Education 2008 Access Projects – Problem Specification.
In this presentation you will:
Chapter 1 - An Introduction to Computers and Problem Solving
Basics of Computer Programming Web Design Section 8-1.
Mrs. Reeves’ 5th Grade Classroom Procedures.
Computer Programming Lecture 23. Summary of Previous Lecture In the previous lecture, we have learnt  Intellectual Property Types of Intellectual Property.
1 CSE1301 Computer Programming Lecture 2: Introduction to Algorithms.
Midterm Review CS 4705 Julia Hirschberg.
CSC103: Introduction to Computer and Programming
1 Introduction to Computing Lecture 02: Introduction to Algorithms Dr. Bekir KARLIK Yasar University Department of Computer Engineering
Control Systems Did you get these? Washing machine Microwave cooker
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
COMPSCI 101 S Principles of Programming Lecture 1 – Introduction.
Problem Solving Methods. Class Objectives Learn to apply the problem solving process Learn techniques for error-free problem solving.
Algorithms 1 (Lecture 2 of CSE1301)
Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 17, 2013 Carolyn Seaman University of Maryland, Baltimore County.
Today in CS161 Lecture #4 Solving Problems with Computers Walk through the Tic Tac Toe Algorithm Getting ready for Creating Programs Turn the Inches to.
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Laurent Noel.
Words to Know Warm-Up Worksheet!
Learning Styles, SQ3R and Note Taking Orientation Study Smarter, Not Harder!
Introduction of Engineering (ENGR 10) Guest Lecture March 24, 2014.
Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 17, 2013 Marie desJardins University of Maryland, Baltimore County.
1 CSE Computer Programming “Using C-Language” Lectures 1.
1 BBG2 Algorithms Components of an Algorithm Instructor: M.Fatih AMASYALI
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 5: Software Design & Testing; Revision Session.
Algorithms CS139 – Aug 30, Problem Solving Your roommate, who is taking CS139, is in a panic. He is worried that he might lose his financial aid.
1 CSE1301 Computer Programming Lecture 3: Components of an Algorithm.
1 CS161 Introduction to Computer Science Topic #9.
1 CSE1301 Computer Programming Lecture 24: Software Engineering.
1 CSE1301 Computer Programming Lecture 3: Components of an Algorithm.
Study Skills 7 November 2015 Diploma in Law. Purpose  Following on from yesterday’s student perspectives session, the purpose of this seminar is to give.
CALL (COMPUTER-ASSISTED LANGUAGE LEARNING)
CS 345 – Software Engineering Nancy Harris ISAT/CS 217
Study Skills for School Success! Presented Ali Cregan and Zo Sanchez.
1 CSE1301 Computer Programming Lecture 4: Components of an Algorithm.
Algorithms CS280 – 10/20/05. Announcement  Part 1 of project 2 due.  Read chapters 10, 7 for this unit  Tuesday we will also be in the classroom We.
Speaking Test PET.
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
CS 101 – Oct. 7 Solving simple problems: create algorithm Structure of solution –Sequence of steps (1,2,3….) –Sometimes we need to make a choice –Sometimes.
How to Revise well… By 10W. Equipment Creating good notes to revise from is important when working, the following equipment can help create imaginative.
1 Structured Programming Arab Academy for Science and Technology CC112 Dr. Sherif Mohamed Tawfik The Course.
Strategies & Knowledge for Independent Learning individual Work SKIL SKIL cards are sets of cards that explain how to use different learning strategies.
School based task 6—task c Glossary of survival English Author:GaoMiao Yang Suqing.
Low-Level Programming Languages, Pseudocode and Testing Chapter 6.
Algorithms and Flowcharts
Polling Question... How do you think you did on the test?
Basics of Computer Programming
Teaching design techniques to design efficient solutions to problems
DCP2073 Asas Pengaturcaraan C Lecture 3: Components of an Algorithm
Basics of Computer Programming
Basics of Computer Programming
Yenka Portfolio Level for this topic: Student Name : My Levels
Welcome to CS 1340! Computing for scientists.
Global Challenge A bag for Juliane Lesson 2.
Coding Concepts (Basics)
Global Challenge A bag for Juliane Lesson 2.
Tonga Institute of Higher Education IT 141: Information Systems
Global Challenge A bag for Juliane Lesson 2.
Global Challenge A bag for Juliane Lesson 2.
Tonga Institute of Higher Education IT 141: Information Systems
Global Challenge A bag for Juliane Lesson 2.
Global Challenge A bag for Juliane Lesson 2.
Global Challenge A bag for Juliane Lesson 2.
Global Challenge A bag for Juliane Lesson 2.
Global Challenge A bag for Juliane Lesson 2.
Software Development Techniques
Module 4 Loops and Repetition 9/19/2019 CSE 1321 Module 4.
Presentation transcript:

Al-Khwarizmi 2 (Lecture 3 of CSE1301) Dr Damian Conway Room 132, Building 26 (Consult hours on the door)

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

Notice Monash is helping develop some national tests for assessing the skills acquired by graduates. Initial versions of these tests will be trialed at the end of this month. Over the next week, many of you will receive a message asking for volunteers for these trials. Those messages will be sent to your Monash student addresses. Please check your Monash regularly over the next week or so.

Recall What is the problem solving process? What is an algorithm? What are some examples? What are the "variables" in the Australian Cricket team?

Topics More components of an algorithm The software development process Top-down design Conway's Game of Life

Components of an algorithm What kind of instructions do we give? What are the building blocks of those instructions?

Components of an algorithm Instruction Sequence (of instructions) Procedure (involving instructions) Selection (between instructions) Repetition (of instructions) Documentation (beside instructions)

Instruction Some action that is simple......and unambigous......that the system knows about......and should be able to actually do.

Instruction 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 into the batter.

Sequence A series of instructions...to be carried out one after the other......without hestitation or question. Example: –Cooking a Gourmet Meal

Sequence 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

Procedure A named sequence Refer to it collectively (by name)...instead of individually (by each instruction in sequence) Example: –Driving to Uni

Procedure procedure DriveToUni { 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 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 }

Selection Choose between two courses of action That is, between two instructions (or sequences or procedures) Decision based on a single true/false question Examples: –Car repairs –Reciprocals –Before driving to uni

Selection if (motor turns) then { CheckFuel CheckSparkPlugs CheckCarburettor } else { CheckDistributer CheckIgnitionCoil }

Selection input Number if (Number ≠ 0) then { output 1/Number } else { output "infinity" }

Selection Before driving to uni

Repetition Repeat an instruction......while (or maybe until) some condition occurs Test the condition each time before repeating the instruction Also known as iteration Example: –Getting a date

Repetition 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 } }

Repetition decide on time and location until (successfully booked) { get next name in little black book AskOnDate(name, time, location) } SighWithRelief

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)

Documentation Thing of something romantic to do (e.g. footy, video games, chess) decide on time and location Work through address book looking for someone who's forgotten what a lousy date I am until (successfully booked) { get next name in little black book AskOnDate(name, time, location) } Will only reach here if someone's memory (or taste) is bad SighWithRelief

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

Designing an algorithm Top-down Bottom-up Object-oriented Prototyping Evolutionary

Top-down design Write down what you have to do Break that into 3-7 smaller steps Break each step into 3-7 smaller steps Keeping subdividing until each individual step is easy enough to do That is, until it's a single instruction Example: –Learning

Top-down design Learn Prepare Study Reinforce Read Make notes Prepare questions Attend lecture Listen and think Complete prac Attend tute Record answers to questions Revise notes Read lecture notes Read textbook Read exercise Design algorithm Code solution Test and document Record insights

The Game of Life Invented by mathematician John Conway (no relation) As seen on millions of screen savers around the world Now in the comfort of your own lecture theatre...

The Game of Life stand up if your age is even while (sign says GO) { count how many people next to you are standing if (exactly 3 of your neighbours are standing) { raise your hand } otherwise if (exactly 2 of your neighbours are standing AND you are standing too) { raise your hand } CHANGE wait till the sign says CHANGE CHANGE wait till the sign doesn't say CHANGE if (your hand is up) { stand up } otherwise { sit down } put your hand down }

stand up if your age is even while (sign says GO) { count how many people next to you are standing if (exactly 3 of your neighbours are standing) { raise your hand } otherwise if (exactly 2 of your neighbours are standing AND you are standing too) { raise your hand } CHANGE wait till the sign says CHANGE CHANGE wait till the sign doesn't say CHANGE if (your hand is up) { stand up } otherwise { sit down } put your hand down } The Game of Life GO

stand up if your age is even while (sign says GO) { count how many people next to you are standing if (exactly 3 of your neighbours are standing) { raise your hand } otherwise if (exactly 2 of your neighbours are standing AND you are standing too) { raise your hand } CHANGE wait till the sign says CHANGE CHANGE wait till the sign doesn't say CHANGE if (your hand is up) { stand up } otherwise { sit down } put your hand down } The Game of Life CHANGE

stand up if your age is even while (sign says GO) { count how many people next to you are standing if (exactly 3 of your neighbours are standing) { raise your hand } otherwise if (exactly 2 of your neighbours are standing AND you are standing too) { raise your hand } CHANGE wait till the sign says CHANGE CHANGE wait till the sign doesn't say CHANGE if (your hand is up) { stand up } otherwise { sit down } put your hand down } The Game of Life STOP

Reading Deitel & Deitel, C: How to program –Chapter 3, Sections 3.8 to 3.13