Understanding Pseudocode and Algorithm Sequences
Pseudocode is a way to represent algorithms using simplified, human-readable code-like language. It helps in outlining the logic of a program without specific syntax. Algorithm sequences are the order in which instructions are executed in a program, typically starting from the beginning and progressing toward the end. This concept is fundamental in algorithm design and programming. The provided examples illustrate how pseudocode can be used to describe processes, such as making a cup of tea, in a structured manner.
Download Presentation
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
Sequence Damian Gordon
Pseudocode When we write programs, we assume that the computer executes the program starting at the beginning and working its way to the end. This is a basic assumption of all algorithm design.
Pseudocode When we write programs, we assume that the computer executes the program starting at the beginning and working its way to the end. This is a basic assumption of all algorithm design. We call this SEQUENCE.
Pseudocode In Pseudo code it looks like this: Statement1; Statement2; Statement3; Statement4; Statement5; Statement6; Statement7; Statement8;
Pseudocode For example, for making a cup of tea: Organise everything together; Plug in kettle; Put teabag in cup; Put water into kettle; Wait for kettle to boil; Add water to cup; Remove teabag with spoon/fork; Add milk and/or sugar; Serve;
Pseudocode Or as a program: PROGRAM MakeACupOfTea: Organise everything together; Plug in kettle; Put teabag in cup; Put water into kettle; Wait for kettle to boil; Add water to cup; Remove teabag with spoon/fork; Add milk and/or sugar; Serve; END.
Pseudocode Or as a program: PROGRAM MakeACupOfTea: Organise everything together; Plug in kettle; Put teabag in cup; Put water into kettle; Wait for kettle to boil; Add water to cup; Remove teabag with spoon/fork; Add milk and/or sugar; Serve; END.
Organise everything together Plug in kettle Put teabag in cup Put water into kettle Turn on kettle Wait for kettle to boil Add boiling water to cup Remove teabag with spoon/fork Add milk and/or sugar Serve
START Organise everything together Plug in kettle Put teabag in cup Put water into kettle Turn on kettle Wait for kettle to boil Add boiling water to cup Remove teabag with spoon/fork Add milk and/or sugar Serve END
Pseudocode So let s say we want to express the following algorithm: Read in a number and print it out.
Pseudocode PROGRAM PrintNumber: Read number; Print out number; END.
Pseudocode So let s say we want to express the following algorithm: Read in a number and print it out double the number.
Pseudocode PROGRAM PrintDoubleNumber: Read number; Print 2 * number; END.