Algorithms

13. Algorithms#

This chapter introduces algorithm foundations using a simple input-process-output model.

Learning Goals

  • Explain an algorithm using input, process, and output

  • Identify sequence, decision, and repetition in algorithm steps

  • Connect efficiency to Big O growth trends

  • Apply a small design checklist before coding

  • Prepare for search and sorting notebooks

The concept of computer algorithm may be represented as the flowchart below.

         INPUT
           │
           ▼
    ┌──────────────┐
    │   STEP  1    │
    └──────┬───────┘
           │
           ▼
    ┌──────────────┐
    │   STEP  2    │
    └──────┬───────┘
           │
           ▼
    ┌──────────────┐        ┌─────────────┐
    │   STEP  3    │──YES──▶│  DO  THIS   │
    │  condition?  │        └─────────────┘
    └──────┬───────┘
           │ NO
           ▼
    ┌──────────────┐
    │   STEP  4    │◀─────────────┐
    └──────┬───────┘              │
           │                      │
           ▼                      │
    ┌──────────────┐              │
    │   loop?      │──────────────┘
    └──────┬───────┘
           │ done
           ▼
         OUTPUT

Chapter flow