What is an algorithm?
Characteristics of an algorithm
Example:
Making coffee
* Pour 1 liter of coffee (Give clear, unambiguous instructions)
* Heat the water and turn off when appropriate (Unclear, ambiguous)
What is a successful algorithm?
A successful algorithm fulfills these three points.
* Accuracy - it leads to the expected outcome
* Consistency - it produces the same result each time it is run
* Efficiency - it solves problem in shortest possible time using fewest possible computer resources
Difference between algorithm and program
Implementations of algorithms
What does a diamond shape represent in a flowchart?
*Selection
* indicates a decision to be made
* It produces True/False leading to two possible outcomes
What does a skew shape represent in a flowchart?
Input/output
What does an arrow shape represent in a flowchart?
What does a rounded rectangle shape represent in a flowchart?
What does a rectangle shape represent in a flowchart?
Flowchart
Pseudocode
Variable
Constant
A container that holds a value that never changes
* Pi value
* Number of m in km
Identifier
Types of naming convention
Variable and constant
Why is a variable useful?
Operator
A character that represents an action
Arithmetic operators
7 types
* Addition (+)
* Subtraction (-)
* Multiplication (*)
* Real division(/) - includes decimal places
* Quotient(DIV) - return whole number
* Modulus(MOD) - return the remainder
* Exponentiation(^) - power of