START
DECOMPOSE
VALID?
ADJUST
SOLVED
The Algorithm
Computational Thinking & Problem Solving
Central Doctrine
Before a computer can execute a solution, a human problem must be transformed into a precise sequence of instructions. This realm explores algorithmic thinking—the bridge between ambiguous reality and deterministic machine execution. We map how to decompose problems, recognize patterns, abstract details, and design step-by-step procedures.
PROBLEM →
DECOMPOSE →
PATTERN RECOGNITION →
ABSTRACTION →
ALGORITHM DESIGN →
IMPLEMENT →
TEST / DEBUG →
SOLUTION
The Internal Chambers
Ontology of Computational Procedures
CHAMBER 01
What is a Problem?
?
→✓
- Problem statement, constraints, and requirements
- Defining Inputs and expected Outputs
- Well-defined vs. Ill-defined problems
- Feasible vs. Infeasible computational problems
CHAMBER 02
Computational Thinking
DECOMPOSE
PATTERN
ABSTRACT
ALGORITHM
- Decomposition, Pattern Recognition, Abstraction
- Algorithmic thinking and logical reasoning
- Formulating problems for automation
CHAMBER 03
Problem Decomposition
- Breaking complex problems into subproblems
- Top-down problem solving and modular thinking
- Managing dependencies between tasks
- Divide and conquer strategy
CHAMBER 04
Abstraction
DATA
- Removing unnecessary detail to highlight essentials
- Creating models and generalizations
- Input-output and procedural abstraction
CHAMBER 05
Pattern Recognition
- Identifying repetition and common structures
- Recognizing similar subproblems
- Reusing known solutions (rules, sequences, trends)
CHAMBER 06
What is an Algorithm?
- A finite, ordered procedure of unambiguous instructions
- Requires specific Inputs and produces specific Outputs
- Deterministic procedures for problem solving
CHAMBER 07
Characteristics
FINITE
DEFINITE
EFFECTIVE
INPUT
OUTPUT
CORRECT
- Finiteness: It must eventually terminate.
- Definiteness: Each step must be clear and unambiguous.
- Effectiveness: Steps must be basic enough to execute.
CHAMBER 08
Algorithm vs. Program
IDEA→CODE
- An algorithm is an abstract, language-independent concept.
- A program is the specific implementation in source code.
- Algorithm correctness vs. Program correctness.
CHAMBER 09
Algorithm vs. Flowchart
↔
- Textual description vs. Visual representation
- Translating sequential flow and decision symbols
- Advantages and limitations of visual modeling
CHAMBER 10
Pseudocode
IF x > 0 THEN
y ← 1
END IF
- Language-independent notation for logic
- Variables, assignment, input/output, conditions
- Importance of indentation and readability
CHAMBER 11
Flowcharts
START
IN
DO
?
- Oval: Start/End | Rectangle: Process
- Parallelogram: I/O | Diamond: Decision
- Mapping sequential flow, branching, and iteration
CHAMBER 12
Sequence
- Step-by-step ordered execution
- Dependency between operations
- Straight-line logic: Input → Process → Output
CHAMBER 13
Decision Making
- Conditional logic and Boolean expressions
- Two-way decisions (if / if-else)
- Nested conditions and multiple branches (else-if)
CHAMBER 14
Repetition & Loops
- Iteration: Executing steps multiple times
- Counter-controlled (for) vs. Condition-controlled (while)
- Loop termination and infinite loops
CHAMBER 15
Counters & Accumulators
- Counter: Tracks occurrences (count = count + 1)
- Accumulator: Running total (sum = sum + value)
- Initialization, update, and termination conditions
CHAMBER 16
Variables & State
- Named storage for changing data
- Assignment, initialization, and update
- Tracking program state during execution
CHAMBER 18
Conditions
x > 5ANDy < 10
TRUE/FALSE
- Equality and Inequality operators (==, >, <=)
- Logical AND, OR, NOT operations
- Compound Boolean expressions and short-circuit logic
CHAMBER 19
Algorithm Strategies
BRUTE
GREEDY
DIVIDE
DYNAMIC
- Brute force, Divide & Conquer, Greedy
- Dynamic programming, Backtracking, Recursion
- Choosing the appropriate strategy for the problem
CHAMBER 20
Brute Force
- Exhaustive search of all possibilities
- Guarantees finding a solution (if it exists)
- Often computationally expensive / slow
CHAMBER 21
Divide & Conquer
- Divide into subproblems → Solve → Combine
- Recursive decomposition
- Used in Merge Sort and Binary Search
CHAMBER 22
Greedy Algorithms
- Making the locally optimal choice at each step
- Does not look ahead or reconsider past choices
- Fast, but may not find the global optimum
CHAMBER 23
Recursion
- A function calling itself
- Requires a Base Case to terminate
- Maintains state on the call stack
- Elegant for tree traversal and factorials
CHAMBER 24
Algorithm Correctness
IN✓
- Preconditions, Postconditions, and Invariants
- Partial correctness vs. Total correctness (termination)
- Testing vs. Formal mathematical proof
CHAMBER 25
Algorithm Testing
✓
✓
✗
✓
- Defining Test Cases (Expected vs. Actual result)
- Normal cases, Boundary cases, Invalid inputs
- Extreme values and random testing
CHAMBER 26
Dry Run & Tracing
x
y
1
0
2
1
- Manual execution of an algorithm
- Using trace tables to track variable state
- Finding logical errors without running code
CHAMBER 27
Edge Cases
- Testing the extremes of the input space
- Empty inputs, single elements, negative values
- Zeros and very large values
- Where algorithms are most likely to fail
CHAMBER 28
Algorithm Efficiency
vs
- Time Complexity (Operations) vs. Space Complexity (Memory)
- Best, Average, and Worst-case scenarios
- Growth of work relative to input size
CHAMBER 29
Time Complexity
- Evaluating how running time scales with input size (n)
- Constant, Linear, Logarithmic, Quadratic rates
- Why algorithm design matters more than raw CPU speed
CHAMBER 31
Big-O Notation
O(n²)
- Asymptotic upper-bound analysis
- Focusing on the dominant term and ignoring constants
- The universal language for comparing algorithms
CHAMBER 34
Searching Algorithms
🔍
- Linear Search: O(n) checking every element
- Binary Search: O(log n) dividing sorted data
- How data organization drastically changes efficiency
CHAMBER 35
Sorting Algorithms
- Bubble, Selection, Insertion Sort (O(n²))
- Merge, Quick Sort (O(n log n))
- Ordering data to enable faster searching
CHAMBER 37
Algorithmic Patterns
- Traversal, Counting, Filtering, Mapping
- Two-pointer and Sliding-window techniques
- Reusable templates for common problems
CHAMBER 39
Graph Algorithms
- Nodes, edges, paths, and connectivity
- Breadth-First vs. Depth-First search
- The foundation of routing and networking
CHAMBER 41
Algorithm Design Process
PROBLEM↓
DECOMPOSE↓
PSEUDOCODE↓
TEST
- Understand constraints → Identify I/O
- Abstract → Design → Implement
- Test → Analyze → Optimize
FINAL CHAMBER
The Bridge to Code
REALM 05 taught the procedure:
PROBLEM → ALGORITHM → PSEUDOCODE
↓
REALM 06 gives it a language.
ALGORITHM → SYNTAX → PROGRAM
- An algorithm is just an idea.
- To run it on a machine, it must be translated.
- Next, we build the programs that execute these ideas.