CSC 180.1 · Introduction to Computer Science and BASIC Programming
Our notes
2 min readAlgorithm
An algorithm is a finite, ordered set of clear steps that solves a problem. Properties:
- Finite: it ends after a number of steps.
- Definite: each step is clear and has one meaning.
- Input: zero or more inputs.
- Output: at least one result.
- Effective: each step can actually be done.
Flowchart symbols
| Symbol | Meaning |
|---|---|
| Oval (terminal) | Start / Stop |
| Parallelogram | Input / Output |
| Rectangle | Process (calculation, assignment) |
| Diamond | Decision (Yes/No) |
| Arrows | Direction of flow |
| Small circle (connector) | joins parts of a chart |
Rules: one start, one stop; flow top to bottom, left to right; each decision has two exits.
The three control structures
- Sequence: steps one after the other.
- Selection: choose a path (IF... THEN... ELSE).
- Repetition (loop): repeat while a condition holds or a set number of times.
Any algorithm can be written with these three.
Worked example 1: average of three numbers
Pseudocode:
- Start.
- Input A, B, C.
- S = A + B + C.
- AVG = S / 3.
- Print AVG.
- Stop.
For 4, 7, 10: S = 21, AVG = 7.
Worked example 2: largest of two numbers
- Input A, B.
- If A > B then print A, else print B.
For A = 12, B = 9, prints 12.
Worked example 3: sum of 1 to N (a loop)
- Input N.
- SUM = 0, I = 1.
- While I ≤ N: SUM = SUM + I; I = I + 1.
- Print SUM.
Trace for N = 5: SUM goes 1, 3, 6, 10, 15: prints 15 (check: N(N+1)/2 = 15 ✓).
Pseudocode
English-like steps, not a real language, easy to turn into code. Keep one action per line and indent the body of loops and decisions.
Dry running (tracing)
Make a table of variables and follow the steps by hand with test data. It finds logic errors before typing the program.
Exams usually ask
- Define an algorithm and state its properties.
- Draw a flowchart for a given problem (roots of a quadratic, grade from score, sum of a series).
- Trace a given algorithm and give its output.
Common mistake
A decision diamond with only one exit, or a loop with no way to stop. Every loop needs a condition that eventually becomes false.
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
Read
-
Best pick Introduction to Computer Science, 3.2 Algorithm Design and Discovery
(opens openstax.org in a new tab)
OpenStax, Introduction to Computer Science, 3.2 Algorithm Design and Discovery, CC BY-NC-SA 4.0 · licence
-
Introduction to Computer Science, 2.1 Computational Thinking
(opens openstax.org in a new tab)
OpenStax, Introduction to Computer Science, 2.1 Computational Thinking, CC BY-NC-SA 4.0 · licence
-
Algorithm
(opens en.wikipedia.org in a new tab)
Wikipedia, Algorithm, CC BY-SA 4.0 · licence
-
Flowchart
(opens en.wikipedia.org in a new tab)
Wikipedia, Flowchart, CC BY-SA 4.0 · licence
-
NOUN CIT 132: Programming in BASIC
NOUN course book (PDF, about 0.8 MB). The whole BASIC programming course.
(opens nou.edu.ng in a new tab)
-
NOUN CIT 108: Problem Solving Strategies
NOUN course book (PDF, about 3.8 MB). Algorithms, flowcharts and solving problems with programs.
(opens nou.edu.ng in a new tab)
-
OpenStax, Introduction to Computer Science (whole free textbook)
The whole book, free to read online or download as a PDF (the PDF is large: Wi-Fi).
(opens openstax.org in a new tab)
OpenStax, OpenStax, Introduction to Computer Science (whole free textbook), CC BY-NC-SA 4.0 · licence
Watch
-
Algorithm Vs Flowchart Vs Pseudocode | Difference Between Algorithm And Flowchart | Intellipaat
7 min · ≈ 32 MB · about ₦18
(opens youtube.com in a new tab)
-
Flow chart to pseudocode | Computer 2025 GCE paper 2
4 min · ≈ 18 MB · about ₦10
(opens youtube.com in a new tab)
-
Flowchart Pseudocode and Algorithm Explained (How They Work Together)
14 min · ≈ 63 MB · about ₦35
(opens youtube.com in a new tab)
-
What is Pseudocode Explained | How to Write Pseudocode Algorithm | Examples, Benefits & Steps
5 min · ≈ 23 MB · about ₦13
(opens youtube.com in a new tab)
-
Algorithm and Flowchart
57 min · ≈ 257 MB · about ₦144
(opens youtube.com in a new tab)
We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.