Pseudocode An Introduction

Slides:



Advertisements
Similar presentations
Lab Management Information. Before Starting a Lab:  1. Wash hands with hot, soapy water for 20 seconds. Rewash whenever necessary.  2. Long hair must.
Advertisements

How Are Algorithms Developed?
Chapter 2: Problem Solving
Chapter 1 - An Introduction to Computers and Problem Solving
Computer Programming Rattapoom Waranusast Department of Electrical and Computer Engineering Faculty of Engineering, Naresuan University.
1 Pseudocode For Program Design. 22 Rules for Pseudocode Write only one statement per line Capitalise initial keyword Indent to show hierarchy and structures.
What is Pseudocode? Pseudocode is "halfway" between english and a programming language. It is a description of a process in detail, though not necessarily.
System Concepts for Process Modeling  Process Concepts  Process Logic  Decomposition diagrams and data flow diagrams will prove very effective tools.
Chapter 9 Describing Process Specifications and Structured Decisions
1 Chapter 8 Designing Small Programs. 2 A ‘Procedure’ v A set of instructions which describe the steps to be followed in order to carry out an activity.
Chapter 3 Planning Your Solution
Review Algorithm Analysis Problem Solving Space Complexity
Programming Logic and System Analysis
CSCI 200 Introduction To Programming with Visual Basic Bob Bradley.
Hand Dishwashing Strategies. Using efficient dishwashing strategies will yield cleaner dishes in a shorter amount of time.
Introduction By: Dr. Javad Razjouyan. Programming Languages.
King Saud University College of applied studies and community services CSC 1101 Computer Programming I Lecture 2.
Lab Procedures and Management. Before Starting a Lab:  1. Wash hands with hot, soapy water for 30 seconds. Rewash whenever necessary.  2. Long hair.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm.
Pseudocode An Introduction. Flowcharts were the first design tool to be widely used, but unfortunately they do not reflect some of the concepts of structured.
Software Development. Software Development Loop Design  Programmers need a solid foundation before they start coding anything  Understand the task.
Lab Management Information. Before Starting a Lab: 1. Wash hands with hot, soapy water for 20 seconds. Rewash whenever necessary. 2. Long hair must be.
Lab Management Information. Before Starting a Lab:  1. Wash hands with hot, soapy water for 20 seconds. Rewash whenever necessary.  2. Long hair must.
DATA STRUCTURES (CS212D) Overview & Review Instructor Information 2  Instructor Information:  Dr. Radwa El Shawi  Room: 
Pseudocode An Introduction. Flowcharts were the first design tool to be widely used, but unfortunately they do not reflect some of the concepts of structured.
Algorithms and Pseudocode
Lab Management Information. Before Starting a Lab:  1. Wash hands with hot, soapy water for 20 seconds. Rewash whenever necessary.  2. Long hair must.
P ROGRAMMING L OGIC GWDA123 Sharon Kaitner, M.Ed. Winter 2015: Week 2.
Sorting Algorithms. Algorithms, revisited What is an algorithm? Wikipedia Definition: an algorithm is a definite list of well-defined instructions for.
Fundamentals of Algorithms MCS - 2 Lecture # 3. Representation of Algorithms.
How Computers Solve Problems Computers also use Algorithms to solve problems, and change data into information Computers can only perform one simple step.
Pseudocode. Algorithm A procedure for solving a problem in terms of the actions to be executed and the order in which those actions are to be executed.
Decision Tables and Pseudocode
Programming Language Basics. What is a Programming Language? “A computer, human-created language used to write instructions for a computer.” “An artificial.
Computer Applications in Business
Washing Dishes! Nutrition & Wellness.
Day 1: Beginning Exploring
Day 2: What variables decrease enzyme function?
Software Development.
GC101 Introduction to computers and programs
Topic: Programming Languages and their Evolution + Intro to Scratch
Programming Languages
High and low level languages
Introduction to Programming and Visual Basic
Kitchen Job Descriptions
Chapter 11 Describing Process Specifications and Structured Decisions
Process Specifications and Structured Decisions
Foods Lab Procedures and Expectations
Pseudocode Upsorn Praphamontripong CS 1110 Introduction to Programming
2.0 Problem Solving PROGRAM DESIGN
Algorithm and Ambiguity
Safety in the Kitchen: Lab Protocols
Data Structures (CS212D) Overview & Review.
Pseudocode An Introduction
(Course Introduction)
Programming Basics - RobotC
Algorithm and Ambiguity
Data Structures (CS212D) Overview & Review.
Programming Language Basics
Understanding Problems and how to Solve them by using Computers
How Are Algorithms Developed?
Chapter 11 Describing Process Specifications and Structured Decisions
ICT Programming Lesson 1:
Lecture 7 Algorithm Design & Implementation. All problems can be solved by employing any one of the following building blocks or their combinations 1.
Introduction to Programming
Reflecting, Learning, Improving
Chapter 1 Introduction to Programming
Pseudocode For Program Design.
Presentation transcript:

Pseudocode An Introduction

Flowcharts were the first design tool to be widely used, but unfortunately they do not reflect some of the concepts of structured programming very well. Pseudocode, on the other hand, is a newer tool and has features that make it more reflective of the structured concepts. The drawback is that the narrative presentation is not as easy to understand and/or follow.

What is Pseudocode? Pseudocode is "halfway" between English and a programming language. It is a description of a process in detail, though not necessarily in full sentences. The key is to provide enough information so that anyone could follow the instructions (a child, an alien, or even a computer, if the instructions were translated into a language it understands). Recipes are one type of pseudocode, instructions for assembling things are another.

Rules for Pseudocode Write only one statement per line Capitalize initial keyword Indent to show hierarchy End multiline structures Keep statements language independent

One Statement Per Line Each statement in pseudocode should express just one action for the computer. If the task list is properly drawn, then in most cases each task will correspond to one line of pseudocode. Task List Read name, hours worked, rate of pay Perform calculations gross = hours worked * rate of pay Write name, hours worked, gross Pseudocode READ name, hoursWorked, payRate gross = hoursWorked * payRate WRITE name, hoursWorked, gross

Capitalize Initial Keyword In the example below note the words: READ and WRITE. These are just a few of the keywords to use, others include: READ, WRITE, IF, ELSE, ENDIF, WHILE, ENDWHILE Pseudocode READ name, hoursWorked, payRate gross = hoursWorked * payRate WRITE name, hoursWorked, gross

Example of Pseudocode for Washing the Dishes Close the sink drain hole squirt some dish liquid in the sink turn on hot water WHILE sink is not full     wait 2 seconds     splash water to create bubbles turn off water (sink is now full of hot, soapy water) put a dishrag in the sink WHILE there are dirty dishes     grab a dish     put dish in the sink     scrub dish with dishrag     IF dish is still dirty         THEN scrub dish with scouring pad     rinse dish     put dish in drainer open the sink drain hole put dishrag in laundry basket Drying the dishes is left as an exercise to the reader :) Even though this description is fairly complex, it still has some pieces missing. If there are nonstick dishes, we don't want to scratch them with the scouring pad. We don't want to wash greasy dishes first, since they will make the water dirty. There are no instructions for times when the dish drainer is full... The pseudocode you write should be detailed enough that it can be understood (by a child, alien, or computer) without being so detailed that it becomes difficult to follow.

Advantages & Disadvantages Flowchart Advantages: Standardized Visual Pseudocode Advantages Easily modified Implements structured concepts Done easily on Word Processor Flowchart Disadvantages: Hard to modify Structured design elements not implemented Special software required Pseudocode Disadvantages: Not visual No accepted standard, varies from company to company

References http://www.cs.indiana.edu/~rscherle/a106/lesson3.html http://faculty.ccri.edu/mkelly/COMI1150/Pseudocode%20Basics.ppt