1 / 18

Chapter 3 : Basic Concepts of Algorithm

Chapter 3 : Basic Concepts of Algorithm. Prepared by Madam Zanariah Idrus. Outline. Software Development Life Cycle Algorithm Pseudocode Exercises. Six step procedure Program specification Program design Program code Program test Program documentation Program maintenance.

hmartin
Download Presentation

Chapter 3 : Basic Concepts of Algorithm

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 3 :Basic Concepts of Algorithm Prepared by Madam ZanariahIdrus

  2. Outline • Software Development Life Cycle • Algorithm • Pseudocode • Exercises

  3. Six step procedure • Program specification • Program design • Program code • Program test • Program documentation • Program maintenance Software Development Life Cycle (SDLC) Page 398

  4. Understanding what the problem is? • What is solution should provide? • Inputs to the problem • Any special constraints/condition/ formulas to be used • 75% of total lifetime cost • Error-free operations • Effective program • Two categories • Operations • Changing needs • Plan a solution • Using Algorithm: - Pseudocode - Flowcharts • Written descriptions and procedures about a program • User manual • Transform design to coding • Writing the program or coding SDLC • Debugging • Syntax errors • Logic errors

  5. Pseudo code • a semi formal English – like language with a limited vocabulary, used to design & describe algorithm • Flowchart • a graph consisting of geometrical shapes that are connected by flow lines, used to design & describe algorithm Algorithms

  6. Problem Program Code Algorithm : A sequence of instructions describing how to do a task (or process) From Algorithms to Programs

  7. Both are sets of instructions on how to do a task • Algorithm: • talking to humans, easy to understand • in plain (English) language • Program: • talking to computer (compiler) • can be regarded as a “formal expression” of an algorithm From Algorithms to Programs

  8. Pseudocode Begin Read number1 Read number2 Add number1 & number2 Display sum End • An outline of the logic for your program • A summary of the program Page 403

  9. Flowchart Page 403

  10. SEQUENCE STRUCTURE SELECTION STRUCTURE LOOP STRUCTURE Flowchart: Logic Structures Page 404

  11. Why algorithm is important? • Describe the steps needed to perform a computation • Important for writing efficient code • code that execute faster & which uses less memory

  12. With sequence structure, an action or event is performed in order, one after another. • A sequence can contain any number of events but there is no chance to branch off and skip any of the events. • Once you start a series of events in a sequence, you must continue step‐by‐step until the sequence ends. Sequence Structure

  13. Problem: • Design a software to calculate the sum of two numbers entered by user. Example 1: sequence

  14. (flowchart) (pseudo code) Steps: • Begin • Read no1 • Read no2 • Add no1 & no2 • Display sum • End start Read no1 Read no2 Display Sum answer=no1+no2 end Example: Add 2 numbers

  15. Example 1 answer

  16. EXERCISES

More Related