Algorithms & Pseudocode & Flowcharts

Algorithms & Pseudocode & Flowcharts Dr. Nouf Aljaffan [email protected] Objectives Learn how to write an algorithm using Flowchart and Pseudocode Nouf Aljaffan (C) 2018 1- Analysis of a problem

Stages in Program Developme nt Process 2- Create the algorithm 3- Compile the program 4- Execute the program 5- Testing and Debugging the Program Nouf Aljaffan (C) 2018 (2) Create the algorithm

Nouf Aljaffan (C) 2018 Plan for solution and use basic statements and expression to develop the algorithm Computational Thinking https://youtu.be/mUXo-S7gzds Nouf Aljaffan (C) 2018 Computational Thinking

Decomposition Pattern Recognition Observing patterns, trends, and regularities in data Abstraction

Breaking down data, processes, or problems into smaller, manageable parts Identifying the general principles that generate these patterns Algorithm Design Developing the step by step instructions for solving this and similar problems

Nouf Aljaffan (C) 2018 Read Input Store data Sequence Calculate Compare

and branch What Can a Program Do? Nouf Aljaffan (C) 2018 Write Output Iterate or Loop Sequence Compare and

branch Iterate or Loop Entry Test condition p false statement a Nouf Aljaffan (C) 2018

false true Exit true statement a No Planning the Solution

Pseudocode is a semi-programming language used to describe the steps in an algorithm. Nouf Aljaffan (C) 2018 Flowchart is a graphical representation of an algorithm.

Planning the Solution 1) Flowchart 2) Pseudocode Start/End Begin/End (not necessary) Input/Output Read/Print : read x,y Process

[An equation] : x=y+6 Comput: compute x as y+6 Decision If/ if-else / While Predefined process [function_name()]: average(x,y) Line

Not Applicable Connector Not Applicable Nouf Aljaffan (C) 2018 Example 1 Sequence Nouf Aljaffan (C) 2018

Example 2 Compare and branch Flowchart Nouf Aljaffan (C) 2018 Pseudocode Example 3 Iterate or Loop Flowchart Pseudocode start

Nouf Aljaffan (C) 2018 End Example 4 Calling predefined processor Nouf Aljaffan (C) 2018 Exercise 1 Write an algorithm to find the perimeter of triangle Nouf Aljaffan (C) 2018

1 Write an algorithm to find greatest of given three numbers Exercise 2 Nouf Aljaffan (C) 2018 2 Write an algorithm to check whether given integer value is PRIME or NOT.

Exercise 3 Nouf Aljaffan (C) 2018 ABC company plans to give a 6% year-end bonus to each of its employees earning Rs 6,000 or more per month , and a fixed Rs 250 bonus to the remaining employees. Write an algorithm to calculate the bonus for an employee

Conclusion The flowchart and the pseudocode were explained There are many styles of pseudocode. Flowchart could be time-consuming but a good tool in education. Nouf Aljaffan (C) 2018

Question! Nouf Aljaffan (C) 2018 References https://computationalthinkingcourse.withgoogle.com/unit Nouf Aljaffan (C) 2018

Recently Viewed Presentations

  • By Omar Durani Prof. Buynak 04/13/06 Allergy =

    By Omar Durani Prof. Buynak 04/13/06 Allergy =

    These substances (ex. Pollen) causes the body to respond with release of Histamine which is main proponent of allergic reactions in individuals. Discovered in 1911 by Sir Henry Dale, identified as a potent vasoactive substance in guinea pigs and dogs...
  • Centripetal Force

    Centripetal Force

    Uniform Circular Motion UCM - motion in a circle of a constant radius at a constant speed Like projectile motion, it's a combo of 2 separate causes:
  • AIDS 2008 PowerPoint Template - TheBody.com

    AIDS 2008 PowerPoint Template - TheBody.com

    * Prior studies have shown that serum TxB2 is higher in men than women Sex related differences in prostaglandin synthesis (PGI2, PGE2) made by endothelial cells from umbilical cord veins - cells from male babies made more of these two...
  • SIR 201: Calculating, Generating Reports, and Presenting the Data

    SIR 201: Calculating, Generating Reports, and Presenting the Data

    Under CMS Reporting, there are 2 documents for CMS assistance. Helpful Tips for CLABSI Reporting for the Centers for Medicare and Medicaid Services' Hospital Inpatient Quality Reporting Programs. Using the "SIR - CLAB Data for CMS IPPS" Output Option. SSI.
  • Network Architecture with Software Programmability Cisco Metro Fabric

    Network Architecture with Software Programmability Cisco Metro Fabric

    BGP control-plane for Ethernet Segment and MAC distribution and learning over MPLS core Same principles and operational experience of IP VPNs No use of Pseudowires
  • Elements Of Poetry

    Elements Of Poetry

    THEME Poetry: Poetry is a form of writing that uses not only words, But also form, Patterns of sound, Imagery, And figurative language To convey the message. Any Poem will include some or all of these elements. ... The road...
  • AAC in 2 hours!

    AAC in 2 hours!

    Words must always be present with symbols or pictures As only one reliable movement is needed to use a graphic system it is ideally suited to those with severe physical impairments. An graphic system will inevitably reduce the rate of...
  • C structures and unions - Michigan Technological University

    C structures and unions - Michigan Technological University

    Bit fields. CS 3090: Safety Critical Programming in C. Portability is an issue: Do any bit field sizes exceed the machine's int size? Is there any pointer manipulation in your code that assumes a particular layout? Bit fields are "syntactic...