1.1

Introduction to Algorithms, Programming, and Compilers

Algorithms are step-by-step processes that can be expressed in written language, diagrams, or code compiled into programs.

1525% of exam
Understand It
Ace It
Context

What this topic is and why it exists

Imagine you're writing a recipe for your grandmother's famous cookies.
You list every step — preheat the oven, mix the butter and sugar, add the eggs — in a precise order so that anyone reading it can recreate those cookies perfectly.
That recipe is an algorithm: a step-by-step process for solving a problem.
Programming works the same way.
You write instructions in a specific order (this is called sequencing), and the computer follows them one at a time, exactly as written.
But here's where it gets tricky.
You write your recipe — your code — in a tool called an IDE, which is basically a smart text editor that helps you write, check, and run your instructions.
When you hit "run," a compiler reads through your code first, like a very strict copy editor.
If you misspell a command or forget a semicolon, the compiler catches that syntax error and refuses to proceed until you fix it.
Think of it as a locked door — no entry until the grammar is perfect.
But the compiler can't catch everything.
If your recipe says "add salt" where it should say "add sugar," the grammar is fine but the cookies taste terrible.
That's a logic error — your instructions run without complaint but produce the wrong result.
You only discover these by tasting the cookies, or in programming terms, by testing your program with specific inputs and checking whether the output matches what you expected.
1 / 9