Tutorial 1: The Big Picture - Algorithms, Data Structures, and Computational Thinking
Introduction to Algorithms, Data Structures, and Computational Thinking
Context: This session serves as the introductory "gentle on-ramp" for the unit CMN123 / CMP123 / CBS108 / GDD at Western Pacific University, Semester 2, 2026.
Instructor: Mr. Eremas Tade.
Session Objective: To establish a high-level "Big Picture" understanding of foundational concepts before transitioning into writing code.
Learning Outcomes (LOs):
LO 1: Define the five essential properties that constitute a real algorithm and explain the nature of a data structure.
LO 2: Distinguish between a problem, an algorithm, and a program, recognizing that a single problem can be solved by multiple algorithms.
2 4: Begin evaluating and judging which method is superior when multiple valid solutions exist.
LO 5: Develop an initial intuition regarding the amount of work (computational effort) an algorithm performs.
Defining the Algorithm: The Five Properties
Interactive Simulation: "Program the Lecturer":
The lecturer acts as a robot, and the students provide instructions to achieve a specific goal: drawing a house on the board.
Rules of the Simulation:
The lecturer follows instructions literally: "no more, no less."
Any ambiguity in instructions is interpreted in "the silliest sensible way."
Instructions must be provided one at a time.
Failures in the drawing process are used to identify which algorithmic rules (properties) were violated.
Conclusion: A functional recipe for a robot must leave nothing to guesswork.
Formal Definition of an Algorithm:
Based on theoretical foundations from Shaffer, and Johnsonbaugh & Schaefer, an algorithm is a clear, finite set of steps designed to take an input, process it, produce the correct output, and then terminate.
The Five Essential Properties:
Input: The initial values provided to the algorithm (note: some algorithms may have zero inputs).
Output: The result produced by the algorithm; it must be the correct result.
Definiteness: Every step in the process must have exactly one unambiguous meaning.
Finiteness: The process must always terminate after a limited (finite) number of steps.
Effectiveness: Each step must be sufficiently simple that it could, in theory, be performed by hand using paper and pencil.
Differentiating Problems, Algorithms, and Programs
The Hierarchy of Implementation:
Problem: Defines what is required (the goal).
Example: "Add up all the numbers in a list."
Algorithm: Defines how the goal is achieved. It consists of clear steps expressed in a way that is independent of any specific programming language. This is often written as pseudocode.
Program: The implementation of the algorithm in a specific programming language, such as Python. This is a version of the algorithm that a computer can execute.
Key Relationships:
One Problem $\Rightarrow$ Many Algorithms (different methods to reach the same goal).
One Algorithm $\Rightarrow$ Many Programs (the same logic can be written in Python, Java, C++, etc.).
The transition from Problem to Algorithm is the design phase.
The transition from Algorithm to Program is the implementation phase.
A First Taste of Efficiency: Guess My Number
The Game Scenario:
The lecturer thinks of a whole number between $1$ and $100$.
Feedback is limited to "higher" or "lower" after each guess.
Comparison of Two Methods:
Round 1 (Free-for-all): Methods like guessing numbers one-by-one (sequential) or guessing randomly.
Workload: In the worst-case scenario, it could take up to $100$ tries to find the correct number.
Round 2 (The "Smart" Way): Always guessing the middle of the currently possible range.
Workload: This method requires at most $7$ guesses for a range of $1$ to $100$.
Why Halving Wins:
Mathematically, you can only cut the range of $100$ in half approximately seven times before reaching a single possibility:
Observation: While both methods are "correct" (they eventually find the number), they differ drastically in the amount of work required. This gap in efficiency grows rapidly as the range of numbers increases.
Future Connections: This "halving trick" is formally known as Binary Search (covered in Week 7). The study of slow vs. fast growth in work is addressed through complexity analysis in Week 6.
What Is a Data Structure?
Data vs. Structure:
Data: The raw values themselves, such as numbers, characters, or records (e.g., the set ${7, 3, 9}$).
Structure: The specific way those values are arranged and how they relate to one another.
Impact of Arrangement:
The same data set can be arranged in different ways (e.g., an unsorted set vs. a sorted list).
The arrangement determines whether specific operations (like searching or sorting) are "cheap" (efficient) or "expensive" (inefficient).
Abstract Data Type (ADT) vs. Data Structure:
ADT: The "promise" or interface; it defines what you can do with the data.
Data Structure: The "build" or physical implementation; it defines how that promise is fulfilled.
(Detailed exploration of these concepts is scheduled for Week 4).
Wrap-up and Next Steps
Summary of Key Points:
Algorithms are defined by five properties: Input, Output, Definiteness, Finiteness, and Effectiveness.
One problem can be solved by many algorithms, which vary significantly in their efficiency (workload).
Data structures involve the arrangement of data, which directly impacts the computational cost of operations.
Next Week: Formal lectures begin, focusing on building and tracing algorithms and data structures using Python.
Questions & Discussion:
Activity: A "Solo Kahoot" game held at
kahoot.it.Format: Fifteen quick-fire questions covering the day's content, including brain-teasers.
Incentive: The top individual on the leaderboard is awarded a can of "Bu" by Mr. Tade.
References
Johnsonbaugh, R., & Schaefer, M. (2004). Algorithms. Pearson Education.
Shaffer, C. A. (2011). A practical introduction to data structures and algorithm analysis (3rd ed.). Virginia Tech.
Uramina, P. (2022). Algorithms and data structures [Unpublished lecture notes]. Western Pacific University.