Glossary
Algorithm
A precise, step-by-step procedure or set of rules for solving a problem or accomplishing a task.
Example:
A recipe for baking cookies is an algorithm because it provides a clear sequence of steps to achieve a desired outcome.
Application Program Interface (API)
A set of rules and specifications that define how different software components or applications should interact and communicate with each other.
Example:
A weather app uses an API to request temperature data from a weather service, without needing to know how the service collects the data.
Arguments
The actual values or expressions passed to a procedure when it is called, which correspond to the procedure's parameters.
Example:
When calling greet('Alice'), 'Alice' is the argument passed to the name parameter.
Array
Another term for a list, referring to an ordered collection of elements, often used interchangeably with 'list' in computer science.
Example:
An array of temperatures might be [72, 75, 68, 70], storing daily high temperatures.
Binary Search
An efficient search algorithm that repeatedly divides the search interval in half, only applicable to sorted data.
Example:
When looking up a word in a dictionary, you open to the middle, then decide if your word is in the first or second half, effectively performing a binary search.
Boolean Value
A data type that can only have one of two possible values: `true` or `false`.
Example:
A variable isLightOn might hold a boolean value of true if the light is on, or false if it's off.
Code Statement
A single instruction or command in a program that performs a specific action.
Example:
The line x ← x + 1 is a code statement that increments the value of x.
Data Types
Categories that classify different kinds of values, such as numbers, text, or true/false values, determining what operations can be performed on them.
Example:
An integer data type is used for whole numbers like 10, while a string data type is used for text like 'Hello'.
Decidable Problem
A problem for which an algorithm can always be constructed to produce a correct solution for every possible input in a finite amount of time.
Example:
The problem of determining if a number is prime is a decidable problem because an algorithm can always give a 'yes' or 'no' answer.
Decision Problem
A type of problem that has a simple 'yes' or 'no' answer.
Example:
Is there a path from point A to point B in this maze? This is a decision problem.
Efficiency
A measure of how well an algorithm utilizes computational resources, such as time or memory, to solve a problem.
Example:
An algorithm that sorts a list quickly with minimal memory usage demonstrates high efficiency.
Element
An individual value or item stored within a list or other data structure.
Example:
In the list of favorite colors ['red', 'blue', 'green'], 'blue' is an element.
Expression
A combination of values, variables, operators, and functions that evaluates to a single result.
Example:
The mathematical expression (5 + 3) * 2 evaluates to 16.
Heuristic
An approach or algorithm that provides a good-enough, approximate solution to a problem, especially when finding an optimal solution is too complex or time-consuming.
Example:
When playing chess, a player might use a heuristic like 'control the center of the board' rather than calculating every possible move.
Index
A numerical position used to identify and access a specific element within an ordered collection like a list or string.
Example:
If a list of students is ['Alice', 'Bob', 'Charlie'], 'Bob' is at index 2 (assuming 1-based indexing as in pseudocode).
Instance
A specific case or set of inputs for a given problem.
Example:
If the problem is sorting a list, then [5, 2, 8, 1] is a particular instance of that problem.
Iteration
The process of repeatedly executing a block of code, typically using a loop, until a certain condition is met or a specified number of times.
Example:
A game might use iteration to repeatedly draw frames on the screen, creating animation.
Linear/Sequential Search
A search algorithm that checks each element in a list one by one, from beginning to end, until the desired element is found or the end of the list is reached.
Example:
Looking for a specific book on a shelf by checking every book from left to right is an example of a linear search.
List
An ordered collection of elements, where each element can be accessed by its position.
Example:
A shopping list might contain items like ['milk', 'eggs', 'bread'], allowing you to keep track of multiple things.
Modularity
The design principle of breaking down a complex program into smaller, independent, and interchangeable components or procedures.
Example:
Building a car from separate engines, wheels, and chassis, rather than one giant piece, demonstrates modularity in design.
Nested Conditional Statements
Conditional statements placed inside other conditional statements, where the inner condition is only evaluated if the outer condition is true.
Example:
To check if a student is eligible for a scholarship, you might use nested conditional statements: IF GPA > 3.5 THEN IF income < 50000 THEN award scholarship.
Optimization Problem
A type of problem that seeks to find the best possible solution among a set of alternatives, often maximizing or minimizing a value.
Example:
Finding the shortest route for a delivery truck to visit multiple stops is an optimization problem.
Parameters
Variables defined in a procedure's header that act as placeholders for the values (arguments) that will be passed into the procedure when it is called.
Example:
In PROCEDURE greet(name), name is a parameter that will hold the specific name passed when greet is called.
Problem
A task or challenge that needs to be solved, often requiring an algorithm to find a solution.
Example:
The problem of finding the shortest route between two cities can be solved using various algorithms.
Procedural Abstraction
The practice of using a procedure without needing to know the details of its internal implementation, focusing only on what it does.
Example:
When you use a PRINT command, you don't need to know how the computer physically displays text; you just know that procedural abstraction allows it to print.
Procedure
A named, reusable block of code that performs a specific task, which can be called from other parts of the program.
Example:
A procedure named calculateTax could take an income as input and return the calculated tax, making the tax calculation reusable.
Reasonable Amount of Time
Refers to algorithms with polynomial or lower time complexity, meaning their execution time grows proportionally to a polynomial function of the input size, making them practical for larger inputs.
Example:
A sorting algorithm that takes n^2 steps for n items runs in a reasonable amount of time.
Selection
A control structure that allows a program to choose which code block to execute based on whether a given condition is true or false.
Example:
An IF statement uses selection to decide whether to display 'It's hot!' or 'It's not hot!' based on the temperature.
Sequencing
The execution of code statements in the order they are written, one after another.
Example:
When you follow instructions like 'first, add water; then, add flour,' you are using sequencing.
Simulation
A simplified representation of a real-world system or process, often used to model and study its behavior under various conditions.
Example:
A computer game that models a city's traffic flow is a simulation of a real-world transportation system.
Software Library
A collection of pre-written code, procedures, and functions that can be reused in new programs to perform common tasks.
Example:
A software library for graphics might contain functions to draw circles or squares, saving programmers from writing that code from scratch.
String
A sequence of characters, often used to represent text in a program.
Example:
The phrase 'Computer Science' is a string of characters.
String Concatenation
The operation of joining two or more strings together to form a single, longer string.
Example:
If 'Hello' is joined with 'World', the string concatenation results in 'HelloWorld'.
Substring
A contiguous portion or segment of a larger string.
Example:
From the string 'pineapple', 'apple' is a substring.
Traverse
To visit or process each element in a data structure, such as a list, typically in a specific order.
Example:
To calculate the sum of all numbers in a list, you would traverse the list, adding each number to a running total.
Undecidable Problem
A problem for which no algorithm can be created that will always produce a correct solution for every possible input, even with infinite time.
Example:
The Halting Problem, which asks if a given program will ever stop running, is a famous undecidable problem.
Unreasonable Amount of Time
Refers to algorithms with exponential or factorial time complexity, meaning their execution time grows extremely rapidly with input size, making them impractical for even moderately large inputs.
Example:
An algorithm that tries every possible combination of items to solve a problem might take an unreasonable amount of time as the number of items grows.
Variable
A named storage location in a program's memory used to hold a value that can change during execution.
Example:
In a game, a score variable might store the player's current points, increasing as they collect items.