Original Source : and Problem and Problem Solving.ppt.

Slides:



Advertisements
Similar presentations
ALGORITHMS AND FLOWCHARTS
Advertisements

Computer Science Department FTSM Algorithm Knowledge: Understand algorithm representation using flowchart and pseudocode Skill: Map problem to solution.
Introduction to Programming
PROBLEM SOLVING TECHNIQUES
PSEUDOCODE & FLOW CHART
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 1 Pseudocode & Flowcharts
Fundamentals of Algorithms MCS - 2 Lecture # 4
Basics of Computer Programming Web Design Section 8-1.
Algorithm Design CS105. Problem Solving Algorithm: set of unambiguous instructions to solve a problem – Breaking down a problem into a set of sub- problems.
Algorithms and Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
Chapter 3 Planning Your Solution
Review Algorithm Analysis Problem Solving Space Complexity
PRE-PROGRAMMING PHASE
ALGORITHMS AND FLOW CHARTS 1 Adapted from the slides Prepared by Department of Preparatory year Prepared by: lec. Ghader Kurdi.
Fundamentals of C programming
Chapter 1 Pseudocode & Flowcharts
ALGORITHMS AND FLOWCHARTS
DCT 1123 Problem Solving & Algorithms
PROGRAMMING, ALGORITHMS AND FLOWCHARTS
CSC141 Introduction to Computer Programming
Lecture 2 Fundamental Data Types. Variable Declaration.
End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.
Software Life Cycle What Requirements Gathering, Problem definition
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.
Control Structures (A) Topics to cover here: Introduction to Control Structures in the algorithmic language Sequencing.
ALGORITHMS AND FLOWCHARTS CSCI 105 – Computer Fluency.
1 Program Planning and Design Important stages before actual program is written.
Fundamentals of Algorithms MCS - 2 Lecture # 5. Representation of Algorithms (continued) Flowcharts.
The Hashemite University Computer Engineering Department
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,
Flowchart. a diagram of the sequence of movements or actions of people or things involved in a complex system or activity. a graphical representation.
Algorithms and Pseudocode
ALGORITHMS AND FLOWCHARTS. Why Algorithm is needed? 2 Computer Program ? Set of instructions to perform some specific task Is Program itself a Software.
STEP 3- DEVELOP AN ALGORITHM At this stage we break down the problem into simple manageable steps so that they can be handled easily.
Lecture 02: Problem Solving & Algorithms.  What is Problem Solving?  How to solve a problem?  Problem Solving Strategies  Solving problem with computer.
PROBLEM SOLVING. What is a Problem? A problem is a situation that needs to be resolved.
Flow Charts And Pseudo Codes Grade 12. An algorithm is a complete step-by- step procedure for solving a problem or accomplishing a task.
CSE 110: Programming Language I Matin Saad Abdullah UB 404.
 Problem Analysis  Coding  Debugging  Testing.
Program design Program Design Process has 2 phases:
Computer Science Department
GC101 Introduction to computers and programs
Basics of Computer Programming
TMC 1414 Introduction to Programming
ALGORITHMS AND FLOWCHARTS
COVERED BASICS ABOUT ALGORITHMS AND FLOWCHARTS
Lecture 2 Introduction to Programming
Introduction To Flowcharting
Basics of Computer Programming
Introduction to Algorithm – part 1
Basics of Computer Programming
Programming Logic n Techniques
ALGORITHMS AND FLOWCHARTS
Unit# 9: Computer Program Development
PROBLEM SOLVING CSC 111.
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
1) C program development 2) Selection structure
ALGORITHMS AND FLOWCHARTS
Chapter 1 Pseudocode & Flowcharts
Introduction to Algorithms and Programming
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
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.
Introduction to Programming
Programming Fundamentals (750113) Ch1. Problem Solving
Basic Concepts of Algorithm
Presentation transcript:

Original Source : and Problem and Problem Solving.ppt

 An algorithm is a set of ordered steps for solving a problem.  Examples:  An algorithm for preparing breakfast.  An algorithm for converting Gregorian dates to Islamic dates.  An algorithm for calculating moon phase.  An algorithm for drawing a curve. 2

 Consider the following … Problem: Baking a Cake How to solve: 1. Start 2. Preheat the oven at 180 o C 3. Prepare a baking pan 4. Beat butter with sugar 5. Mix them with flour, eggs and essence vanilla 6. Pour the dough into the baking pan 7. Put the pan into the oven 8. End 3

Problem: Prepare a Breakfast 4 1.Start 2.Prepare a Breakfast 3.End

1. Start 2. Prepare a Breakfast 2.1 Prepare a tuna sandwich 2.2 Prepare some chips 2.3 Make a cup of coffee 3. End 5

1. Start 2. Prepare a Breakfast 2.1 Prepare a tuna sandwich Take 2 slices of bread Prepare tuna paste 2.2 Prepare some chips 2.3 Make a cup of coffee 3. End 6

1. Start 2. Prepare a Breakfast 2.1 Prepare a tuna sandwich Take 2 slices of bread Prepare tuna paste 2.2 Prepare some chips Cut potatoes into slices Fry the potatoes 2.3 Make a cup of coffee 3. End ‘DIVIDE AND CONQUER’ STRATEGY IN ALGORITHM 7

1. Start 2. Prepare a Breakfast 2.1. Prepare a tuna sandwich Take 2 slices of bread Prepare tuna paste 2.2. Prepare some chips Cut potatoes into slices Fry the potatoes 2.3. Make a cup of coffee Boil water Add water with sugar and coffee 3. End ‘DIVIDE AND CONQUER’ STRATEGY IN ALGORITHM 8

 Write a simple algorithm for withdrawing a sum of money at an ATM. 9

 If we wish to build a house, we need to design it first. ◦ Can you think of some possible consequences of not designing a house before building it?  Similarly, computer programs (especially large and complex ones) need to be designed before they are written. ◦ Can you think of some possible consequences of not designing a program before building it?  One of the things considered when designing a computer program is the algorithm which it will be based on. 10

 A computer program is built to solve a certain problem. Examples: 1.A program to calculate the grade obtained given a mark. 2.A program to convert a Gregorian date to an Islamic date. 3.A program to produce a document. 11

 Below are steps (in fact, an algorithm) for building a program to solve a particular problem: ◦ Analyse the problem ◦ Design a computer solution to the problem by developing an algorithm. ◦ Write a computer program based on the algorithm. ◦ Test the program. 12

 An algorithm must be specific enough so that it can be conveniently translated into a computer program (using C++, for example).  An algorithm can be specified: ◦ Textually For example, using pseudo code (see later) ◦ Graphically For example, using flowcharts or UML activity charts 13

 A flowchart is a graphical representation of the sequence of operations in a program.  An algorithm can be represented graphically using a flowchart. 14

15 Start/End SymbolSemantic Process Input/Output Test Connector Flow of activities

16 Start End Input Gregorian date Display Islamic date Convert Gregorian date to Islamic date Algorithm starts here Algorithm ends here Display the result Perform the date conversion Input data from user

 An outline of a program, written in a form that can easily be converted into real programming statements. It resembles the actual program that will be implemented later. However, it cannot be compiled nor executed.  Pseudocode normally codes the following actions: ◦ Initialisation of variables ◦ Assignment of values to the variables ◦ Arithmetic operations ◦ Relational operations 17

1. Start quantity 2. Read quantity price_per_kg 3. Read price_per_kg price  quantity * price_per_kg 4. price  quantity * price_per_kg price 5. Print price 6. End 18

 Draw a flowchart which represents the algorithm built in CA[5.1]. 19

20 Start End Input length, width Output area area ← length X width length, width and area are referred to as variables. A variable is like a box in which a value can be stored

 Selection 21 true height > 1.6? false Output “You are tall!” Output “You are short!” Input height Start End

 Repetition (looping) 22 true false Output “Thank you!” Input stop stop = 1? Start End

 what an algorithm is.  when an algorithm should be developed when building a computer program.  the basic steps in building a computer program to solve a problem.  what flowcharts are.  how to represent algorithms graphically using flowcharts. 23