Introduction to Computer Science and Algorithmic Problem Solving
Core Learning Objectives
- Understand the Definition of an Algorithm: Master both the informal definition and the rigorous formal definition of an algorithm.
- Understand the Formal Definition of Computer Science: Recognize computer science as the study of algorithms rather than merely computer hardware or software.
- Construct Everyday Algorithms: Express routine real-world activities as precise, step-by-step algorithms.
- Identify Algorithmic Properties: Evaluate whether a given procedure is unambiguous, effectively computable, or contains logical flaws such as infinite loops.
- Trace Historical Roots in Mathematics and Mechanics: Appreciate how modern computer science evolved from early mathematical concepts and mechanical calculating machines.
- Summarize Electronic Computer Evolution: Identify key milestones, technological shifts, and generational phases in the development of modern electronic computers.
Misconceptions About Computer Science
- Misconception 1: Computer science is the study of computers.
- Computers are simply the machinery used to execute algorithms; studying computer science solely as hardware is analogous to defining astronomy as the study of telescopes.
- Misconception 2: Computer science is the study of how to write computer programs.
- Programming is a practical tool and mechanism for expressing algorithms, but coding itself is not the ultimate object of study.
- Misconception 3: Computer science is the study of the uses and applications of computers and software.
- Learning to operate software packages or computing applications is user training, not computer science.
- Definition: Computer science is the study of algorithms, including:
- Their Formal and Mathematical Properties: Analyzing their efficiency, correctness, limits, and mathematical structure.
- Their Hardware Realizations: Designing and constructing physical computing systems capable of executing algorithms.
- Their Linguistic Realizations: Creating programming languages and formal notations to express algorithms precisely.
- Their Applications: Applying algorithms to solve real-world problems across diverse fields.
Algorithmic Definitions and Core Properties
- Informal Definition: An ordered sequence of instructions guaranteed to solve a specific problem.
- General Structure Template:
- Step 1: Do something
- Step 2: Do something
- Step 3: Do something
- …
- Step n: Stop
- Formal Definition: A well-ordered collection of unambiguous and effectively computable operations that, when executed, produces a result and halts in a finite amount of time.
- Detailed Breakdown of Formal Criteria:
- Well-Ordered Collection:
- The sequence of operations is clear and explicit; upon completing any step, the computing agent uniquely knows which operation to execute next.
- Unambiguous Operations (Primitives):
- An operation is unambiguous if it can be directly understood by the computing agent without requiring further definition, clarification, or simplification.
- Effectively Computable Operations:
- It is insufficient for an operation to be merely understandable; it must also be physically doable (executable) by the computing agent.
- Examples of Ambiguous or Ineffective Statements:
- "Go back and do it again" (Ambiguous: Do what again?)
- "Start over" (Ambiguous: From where?)
- Produces a Result:
- To verify correctness, an algorithm must output an observable result, such as:
- A numerical answer
- A new object
- A visible change in the environment
- Halts in a Finite Amount of Time:
- Execution must eventually conclude. An algorithm that runs indefinitely is trapped in an infinite loop, which represents a flaw or bug in algorithmic design.
Operations Used to Construct Algorithms
- Sequential Operations:
- Executes a single, well-defined task in sequential order.
- Conditional Operations:
- Asks a question/evaluates a condition, and selects the next operation based on the specific answer or boolean outcome.
- Iterative Operations:
- Looping instructions that instruct the computing agent not to move forward, but to loop back and re-execute a specified prior block of instructions.
Practical Examples of Everyday Algorithms
- Making a Morning Coffee Algorithm:
- Step 1: Decide to make coffee.
- Step 2: Fill the kettle with water and turn it on.
- Step 3: Add a filter to the Coffee Maker machine.
- Step 4: Measure and add coffee grounds to the filter.
- Step 5: Pour the water into the machine's reservoir.
- Step 6: Allow the coffee to brew for the appropriate time.
- Step 7: Pour the coffee into a cup.
- Step 8: Add any desired extras like milk, sugar, or flavors.
- Step 9: Enjoy your coffee.
- Crossing The Street Algorithm:
- Step 1: Decide to cross the street.
- Step 2: Locate a designated crosswalk or intersection.
- Step 3: Signal Check:
- If the signal indicates it is safe to cross (e.g., green light or walk signal), proceed to the next step.
- If the signal indicates not to cross (e.g., red light or don't walk signal), wait.
- Step 4: Even if the signal says it is safe, check for oncoming vehicles from both directions.
- Step 5: Cross the street quickly and safely. Keep an eye out for any unexpected hazards.
- Step 6: Continue walking until you have safely reached the other side of the street.
- Step 7: You reached the other side.
Importance of Algorithmic Problem Solving & Computing Agents
- Automation of Solutions: Specifying a formal algorithm enables the problem-solving process to be fully automated.
- Computing Agent: The physical or abstract entity (machine, robot, person, or system) responsible for executing the instructions of an algorithm.
- Categories of Unsolved Problems:
- Unsolvable Problems: Problems for which no algorithm can ever be devised.
- Intractable Problems: Problems where algorithms exist, but execution is too slow to be practically useful.
- Unknown Problems: Problems whose algorithmic solutions have not yet been discovered.
- Historical Paradigm Shift:
- Nineteenth-Century Industrial Revolution: Mechanized and automated repetitive physical tasks.
- Twentieth/Twenty-First Century Computer Revolution: Mechanized and automated repetitive mental tasks using algorithms and computer hardware.
Brief History of Computing: The Early Period (Up to 1940)
- Seventeenth-Century Innovations (Arithmetic Automation):
- 1614: John Napier invented logarithms to simplify complex scientific calculations.
- 1622: Invention of the first slide rule.
- 1642: Blaise Pascal designed and built the Pascaline, an early mechanical calculator.

- 1673: Gottfried Leibnitz constructed a mechanical calculator known as Leibnitz's Wheel.
- Capabilities and Limitations of 17th-Century Devices:
- Could represent numbers and perform basic arithmetic.
- Lacked internal memory to store information.
- Were not programmable (could not run user-specified instruction sequences).
- Nineteenth-Century Advances:
- 1801: Joseph Jacquard created an automated loom that utilized punched cards to weave intricate patterns.

- 1880s onward: Herman Hollerith built programmable punched-card machines to tally and sort U.S. Census Bureau data; founded the company that became IBM in 1924.
- Charles Babbage:
- 1823: Designed and built the Difference Engine, capable of addition, subtraction, multiplication, and division to six significant digits, and solving polynomial equations.

- Analytical Engine: Designed (though never constructed), mechanical programmable machine with architecture mirroring modern computers:
- Mill: Arithmetic/logic unit (ALU)
- Store: Memory
- Operator: Central processor
- Output Unit: Input/Output mechanism
- Characteristics of 19th-Century Devices:
- Remained strictly mechanical rather than electrical.
- Introduced data representation, manipulation operations, memory storage, and programmability via predesigned instruction sequences.
The Birth of Electronic Computers (1940–1950)
- Key Early Machines:
- 1943: Colossus, a general-purpose electronic machine constructed by Alan Turing for the British Enigma codebreaking initiative.
- 1944: Mark I, an electromechanical computer using relays, magnets, and gears.
- 1946: ENIAC (Electronic Numerical Integrator and Calculator), the first publicly disclosed, fully electronic general-purpose computer.

- John Von Neumann & The Stored-Program Concept:
- Proposed storing programs and data together in memory (the stored-program computer model).
- 1949: EDVAC constructed at the University of Pennsylvania based on Von Neumann's architecture.
- UNIVAC I: Commercial derivative of EDVAC, becoming the first commercially sold computer.
- The Von Neumann architecture remains the standard architectural foundation for modern computing systems.
The Modern Era of Computing (1950 to Present)
- First Generation (1950–1957):
- Based on EDVAC design architecture.
- Utilized vacuum tubes for processing and storage.
- Physically massive (room-sized), expensive, fragile, and required specialized operating environments and trained personnel.

- Second Generation (1957–1965):
- Replaced vacuum tubes with transistors and magnetic core memory.
- Witnessed the emergence of high-level programming languages such as FORTRAN and COBOL.

- Third Generation (1965–1975):
- Introduced integrated circuits (ICs).
- Birth of desk-sized minicomputers.
- Establishment of the commercial software industry.

- Fourth Generation (1975–1985):
- Era of single-chip microprocessors.
- Development of desktop microcomputers (personal computers).
- Widespread computer networking, electronic mail, graphical user interfaces (GUIs), and embedded systems.

- Fifth Generation (1985–Present/Future):
- Massively parallel processors performing quadrillions (1015) of computations per second.
- Handheld mobile digital devices and pervasive wireless communications.
- Advanced multimedia interfaces with voice recognition, video, and audio synthesis.
- Massive cloud storage infrastructure and ubiquitous computing.
- Ultra-high-resolution graphics and virtual reality systems.
Summary
- Computer Science: The scientific study of algorithms, their properties, hardware, language, and applications.
- Algorithm Definition: A well-ordered collection of unambiguous and effectively computable operations that produces a result and halts in a finite amount of time.
- Automation: Specifying an algorithm enables automated computation by a computing agent.
- Historical Development: Computing evolved from mechanical arithmetic calculators (Pascaline, Difference Engine) to electromechanical devices, electronic stored-program systems (EDVAC, UNIVAC), and modern miniaturized microprocessors.