Week 2 Lec - Algorithm, Pseudocode, Flowchart (PDF)
Document Details
Uploaded by Deleted User
National University - Dasmariñas
Joevan U. Sacdalan
Tags
Summary
This document is a lecture on algorithm, pseudocode, and flowchart. It covers the concepts of algorithms, pseudocode, and flowcharts along with examples and how to write pseudo code through diagrams. The lecture is categorized under computer programming and engineering.
Full Transcript
NU - DASMARIÑAS Algorithm, Pseudocode, Flowchart Introduction to Computing Week 2 1st Term 2024 - 2025 Joevan U. Sacdalan School of Engineering, Computing, and Architecture Algorithm a procedure used for solving a problem or performing a computation. act as an exact list of instruct...
NU - DASMARIÑAS Algorithm, Pseudocode, Flowchart Introduction to Computing Week 2 1st Term 2024 - 2025 Joevan U. Sacdalan School of Engineering, Computing, and Architecture Algorithm a procedure used for solving a problem or performing a computation. act as an exact list of instructions that conduct specified actions step by step in either hardware- or software-based routines. Examples of Algorithms in Everyday Life Tying Your Shoes. Following a Recipe. Classifying Objects. Bedtime Routines. Finding a Library Book in the Library. Driving to or from Somewhere. Deciding What to Eat. Pseudocode a way of writing or describing programming code or algorithms in a natural language such as English. cannot be compiled nor executed as it is only meant to be read by humans. also known as false code or representation of code. How to write a Pseudo-code? Arrange the sequence of tasks and write the pseudocode accordingly. Start with the statement of a pseudo code which establishes the main goal or the aim. How to write a Pseudo-code? The way the if-else, for, while loops are indented in a program, indent the statements likewise, as it helps to comprehend the decision control and execution mechanism. They also improve the readability to a great extent. How to write a Pseudo-code? Use appropriate naming conventions. The human tendency follows the approach to follow what we see. If a programmer goes through a pseudo code, his approach will be the same as per it, so the naming must be simple and distinct. Use appropriate sentence casings, such as CamelCase for methods, upper case for constants and lower case for variables. Elaborate everything which is going to happen in the actual code. Don’t make the pseudo code abstract. How to write a Pseudo-code? Use standard programming structures such as ‘if-then’, ‘for’, ‘while’, ‘cases’ the way we use it in programming. Check whether all the sections of a pseudo code is complete, finite and clear to understand and comprehend. Don’t write the pseudo code in a complete programmatic manner. It is necessary to be simple to understand even for a layman or client, hence don’t incorporate too many technical terms. Flowchart a diagram that depicts a process, system or computer algorithm. a graphical representation of a computer program in relation to its sequence of functions (as distinct from the data it processes). Flowchart Flowchart Flowchart Examples Create a flowchart for a program that will display the text “Hello World”. Flowchart Examples Create a flowchart for a program that will add two numbers entered by the user. Flowchart Examples Create a flowchart for a program that will determine if the grade entered by the user is “passed” or “failed”. *passing grade = 75 References https://www.techtarget.com/whatis/definition/algorithm https://www.geeksforgeeks.org/how-to-write-a-pseudo-code/ https://www.smartdraw.com/flowchart/flowchart-symbols.htm