1/17
lessons 5&6
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Algorithm
a set of well-defined instructions to solve a particular problem. It takes a set of input(s) and produces the desired output.
Qualities of a good algorithm
Input and output should be defined precisely.
Each step in the algorithm should be clear and unambiguous.
Algorithms should be most effective among many different ways to solve a problem.
An algorithm shouldn't include computer code. Instead, the algorithm should be written in such a way that it can be used in different programming languages.
Consist of clear, practical steps executable in limited time by a person or machine.
Be unambiguous, with defined steps, including decision points (e.g.,“if” statements).
Have a finite number of steps, using loops for repeated actions.
Reach an endpoint, avoiding infinite loops.
How does Algorithm work
take a set of initial data or input, process it through a series of logical steps or rules, and generates an output, which can be the outcome, decision, or result.
Types of algorithms or control flow
Linear Sequence Algorithm
Conditional Algorithm
Looping Algorithms
Types of algorithms or control flow: Linear Sequence Algorithm
follow a specific set or steps, one after the other.
Types of algorithms or control flow: Conditional Algorithm
make a decision between two actions.
Types of algorithms or control flow: Looping Algorithms
repeat a specific set of instructions multiple types until either a certain condition is met or a predefined number of repetitions has been completed.
Pseudocode
defined as a step-by-step description of an algorithm. Pseudocode does not use any programming language in its representation instead it uses the simple English language text as it is intended for human understanding rather than machine reading.
Main constructs of pseudocode
SEQUENCE
WHILE
REPEAT-UNTIL
FOR
IF-THEN-ELSE
CASE
Main constructs of pseudocode : SEQUENCE
INPUT: READ , OBTAIN, GET
OUTPUT: PRINT, DISPLAY, SHOW
COMPUTE: COMPUTE, CALCULATE, DETERMINE
INITIALIZE: SET, INIT
ADD: INCREMENT
SUB: DECREMENT
Main constructs of pseudocode : FOR

Main constructs of pseudocode : WHILE

Main constructs of pseudocode :CASE

Main constructs of pseudocode : REPEAT-UNTIL

Main constructs of pseudocode :IF-THEN-ELSE

Extra constructs of Pseudocode
CALLING CLASSES or FUNCTIONS
EXCEPTION HANDLING
Extra constructs of Pseudocode:CALLING CLASSES or FUNCTIONS

Extra constructs of Pseudocode:EXCEPTION HANDLING
