Algorithm Design CS105. Problem Solving Algorithm: set of unambiguous instructions to solve a problem – Breaking down a problem into a set of sub- problems.

Slides:



Advertisements
Similar presentations
PROBLEM SOLVING TECHNIQUES
Advertisements

1 ICS102: Introduction To Computing King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science.
COMPUTER PROGRAMMING I Understand Problem Solving Tools to Design Programming Solutions.
1.4 Programming Tools Flowcharts Pseudocode Hierarchy Chart
PSEUDOCODE & FLOW CHART
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Basics of Computer Programming Web Design Section 8-1.
CS105 INTRODUCTION TO COMPUTER CONCEPTS INTRO TO PROGRAMMING Instructor: Cuong (Charlie) Pham.
Chapter 2- Visual Basic Schneider
Program Design and Development
Lecture Notes 1/21/04 Program Design & Intro to Algorithms.
Programming Fundamentals (750113) Ch1. Problem Solving
Chapter 2: Algorithm Discovery and Design
CHAPTER 4: ALGORITHM 4.1 Introduction stages identified in the program development process: 1. Problem analysis and specification 2. Data organization.
Chapter 3 Planning Your Solution
Original Source : and Problem and Problem Solving.ppt.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Flowcharts.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
IXA 1234 : C++ PROGRAMMING CHAPTER 1. PROGRAMMING LANGUAGE Programming language is a computer program that can solve certain problem / task Keyword: Computer.
Chapter 2: General Problem Solving Concepts
Definition of Terms Software/Programs Programs that directs the operation of a computer system Set of instructions Codes Programming Process of planning,
Cs413_design04.ppt Design and Software Development Design : to create a functional interface that has high usability Development : an organized approach.
CS221 Algorithm Basics. What is an algorithm? An algorithm is a list of instructions that transform input information into a desired output. Each instruction.
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
1 Program Planning and Design Important stages before actual program is written.
CSCI-100 Introduction to Computing
Program Design. The design process How do you go about writing a program? –It’s like many other things in life Understand the problem to be solved Develop.
Program Development C# Programming January 30, 2007 Professor J. Sciame.
1 Programming Tools Flowcharts Pseudocode Hierarchy Chart Direction of Numbered NYC Streets Algorithm Class Average Algorithm.
The Hashemite University Computer Engineering Department
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
Problem-solving with Computers. 2Outline  Computer System  5 Steps for producing a computer program  Structured program and programming  3 types of.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
WHAT IS THIS? Clue…it’s a drink SIMPLE SEQUENCE CONTROL STRUCTURE Introduction A computer is an extremely powerful, fast machine. In less than a second,
Expressing Algorithms as Flowcharts and Pseudocode
Flowcharts C++ Lab. Algorithm An informal definition of an algorithm is: a step-by-step method for solving a problem or doing a task. Input data A step-by-step.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
PROBLEM SOLVING. What is a Problem? A problem is a situation that needs to be resolved.
Progression in KS3/4 Algorithms MONDAY 30 TH NOVEMBER SUE SENTANCE.
How Computers Solve Problems Computers also use Algorithms to solve problems, and change data into information Computers can only perform one simple step.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
1 Structured Programming Arab Academy for Science and Technology CC112 Dr. Sherif Mohamed Tawfik The Course.
Algorithms and Flowcharts
Program design Program Design Process has 2 phases:
ICS 3UI - Introduction to Computer Science
Basics of Computer Programming
CS1001 Programming Fundamentals 3(3-0) Lecture 2
Programming Problem steps must be able to be fully & unambiguously described Problem types; Can be clearly described Cannot be clearly described (e.g.
Basics of Computer Programming
Basics of Computer Programming
Algorithm and Ambiguity
CPSC 1301 Columbus State University
Problem Solving Techniques
Algorithms & Pseudocode
Programming Fundamentals (750113) Ch1. Problem Solving
Computational Thinking for KS3
Introduction to Algorithms and Programming
CS105 Introduction to Computer Concepts Intro to programming
SCIENCE ON FRIDAYS.
Algorithm and Ambiguity
Introduction to Algorithms - 1
Programming Fundamentals (750113) Ch1. Problem Solving
Click to add Text Computers & Instructions. Computers are given instructions in the form of computer programs that are created through the development.
Programming Fundamentals (750113) Ch1. Problem Solving
Basic Concepts of Algorithm
CS105 Introduction to Computer Concepts Intro to programming
WRITING AN ALGORITHM, PSEUDOCODE, AND FLOWCHART LESSON 2.
Presentation transcript:

Algorithm Design CS105

Problem Solving Algorithm: set of unambiguous instructions to solve a problem – Breaking down a problem into a set of sub- problems – Example: Clean the house Without instructions – computers cannot do anything at all!

Algorithm design 1.Analysis and specification -Analyze: Understand/define the problem -Specify: Specify particulars 2.Algorithm development phase -Develop: Logical sequence of steps -Test: Follow outline, test cases 3.Implementation phase -Code: The steps into a programming language -Test: Debug 4.Maintenance phase -Use the program -Maintain: Correct errors, meet changing requirements

An example: Variables Output

An example: Variables: A= loaf of bread K= knife T= toaster P= plate B= butter CB= cutting board Making a perfect piece of toast Version 2 1. move A to CB 2. cut S with K 3. move S to T 4. turn on T 5. wait for T 6. move S to P 7. spread B on S with K S= slice of bread move

An example: Variables: A= loaf of bread K= knife T= toaster P= plate B= butter M= margarine F= friend CB= cutting board Making toast for fussy friends: plain, butter, margarine Version 3 Move A to CB FOR every F eating toast { Cut S with K Move S to T Turn on T Wait for T Move S to P IF F likes B { X=B } ELSE IF F likes M { X=M } ELSE { X= NOTHING } Spread X on S with K } S= slice of bread X

Basic concepts Example contains concepts used in most algorithms Instructions – simple and unambiguous Variables – input and temporary Subprocedures – smaller tasks Looping: FOR each variable, WHILE – Act of repeating tasks Conditional statements: IF ELSE – Selectively execute instructions

Pseudocode: Flowchart Flowchart: diagram that represents an algorithm Symbols: START, END LOOPS, FLOW OF CONTROL INSTRUCTIONS CONDITIONALS

Pseudocode: Flowchart Fixing non functioning lamp algorithm

Flowchart: Making toast for friends Variables: A= loaf of bread K= knife T= toaster P= plate B= butter M= margarine F= friend CB= cutting board S= slice of bread X Start Move A to CB Done ? Cut S with K Move S to T Turn on T End Wait for T Move S to P Want B? Want M? Set X to B Set X to M Set X to NONE Spread X on S with K Yes No Yes No Yes No

Start End Add 30 to X Multiply X by 3 Is X > 100 ? Is X < 80 ? Subtract 15 from X Print X Yes No Yes Divide X by 2 Is X an integer ? Yes No Round it to the nearest integer

Add 30 to X IF ( x>100) { Subtract 15 from X } ELSE { Multiply X by 3 } IF ( x<80) { PRINT X } ELSE { Divide X by 2 IF ( X is an integer) { PRINT X } ELSE { Round X to the nearest integer PRINT X } 1.Add 30 to X 2.IF X >100, subtract 15 3.ELSE multiply X by 3 4.IF X<80, PRINT X END 5.ELSE Divide by 2 1.IF X is an integer, PRINT X END 2.ELSE round X, then PRINT X END