You are on page 1of 2

CSCI 150 8/25/17

5 elements of algorithms
1. Input
a. Is there lava? Get information from the world.
2. Output
a. Place cobblestone, movement, mining. Produce some response.
3. Math
a. Boolean value (yes or no).
4. Conditionals
a. Check for lava; if so, place stone. (Making a decision.)
5. Repetition
a. Repeat x times.

Computer examples
Email

Self-checkout at grocery store

1. Input
a. Barcodes. Request $ type. Coupons. Typing item codes. Scale. Pin #. Bag check.
2. Output
a. Noise. Information on LCD. Laser to strike the barcode.
3. Math
a. Total $ spent and paid. Convert barcode. Weight calculation.
4. Conditionals
a. Did you place item in bag? Have you paid? Do you need to enter a code?
5. Repetition
a. For every customer. For each item.

Games

ATMs

ID card

Unlocking phone

Social media

Calculator

GPS

Watching movies

Elevator

Errors
1. Syntax
a. Incomprehensible, typso if something falls out of the grammar.
2. Semantic
a. Doesnt do what you want You gave it instructions to get to a goal but did not get
there.
3. Runtime
a. Forced exit. The program aborts due to an input from the world. Dying in lava.

Assignment
Go to class webpage and check out HW.

You might also like