# Lectures

This page provides information about online lectures and
lecture slides for use in teaching and learning from the book
*Computer Science: An Interdisciplinary Approach*. These lectures are
appropriate for use by instructors as the basis for a “flipped” class
on the subject, or for self-study by individuals.

## Flipped classroom.

If you are an an instructor teaching introductory computer science, an effective way for you to teach the material in a typical college class is to adhere to a weekly cadence, as follows:- Each week, send an email to all students in the class that briefly describes activities for that week (lectures, reading, and programming assignments drawn from the book or from this booksite).
- Students watch the lecture videos at their own pace, do the readings, and work on the programming assignments.
- Schedule a weekly “class meeting” for discussion of the material, reviews for exams, informal interaction with students, and any enrichment material you may wish to cover.

*Important note:* A common mistake in teaching a flipped class
is to add too much enrichment material. Our experience is that time in
class meetings is much better spent preparing students for success on
programming assignments and exams. If an instructor makes it clear that the best
way to prepare for exams is to watch the lecture videos and do the reading,
most students will do so. Class meetings then can involve interacting
with students and with the material in such a way as to reinforce
understanding. For example, working with potential exam questions is an
excellent activity.

## Self-study.

An effective way to learn the material on your own is to watch the lecture videos on some regular schedule, do the associated reading, and attempt to solve some of the exercises in the book or on the booksite on your own. If you get stuck on a particular exercise, find some others or try to solve some of the problems given in the lectures without looking at the solutions there.## Available lectures.

The lecture videos are available for purchase through Pearson. When watching a lecture video, it is*very important*to choose an appropriate speed. If it is too slow, you are likely to be bored; if it is too fast, you are likely to get lost. Also be sure to make liberal use of pause and rewind.

The slides used in the lectures are available in .pdf format by clicking the links in the lecture titles below.

Lecture 0: Prologue—A Simple Machine.This lecture introduces fundamental ideas of computation in the context of a familiar and important application from the field of cryptography. The story motivates the study of computer science, but the concepts covered are a bit advanced, so novices may wish to review it again after watching the other lectures in the course.

Lecture 1: Basics.Why program? This lecture addresses that basic question. Then it describes the anatomy of your first program and the process of developing a program in Java using either virtual terminals or a program development environment, with some historical context. Most of the lecture is devoted to a thorough coverage of Java's built-in data types, with example programs for each.

Lecture 2: Conditionals and Loops.The if, while, and for statements are Java's fundamental control structures. This lecture is built around short programs that use these constructs to address important computational tasks. Examples include sorting, computing the square root, factoring, and simulating a random process. The lecture concludes with a detailed example illustrating the process of debugging a program.

Lecture 3: Arrays.Computing with a large sequence of values of the same type is extremely common. This lecture describes Java's built-in array data structure that supports such applications, with several examples, including shuffling a deck of cards, the coupon collector test for randomness, and random walks in a grid.

Lecture 4: Input and Output.To interact with our programs, we need mechanisms for taking information from the outside world and for presenting information to the outside world. This lecture describes several such mechanisms: for text, drawings, and animation. Detailed examples covered include fractal drawings that model natural phenomena and an animation of a ball bouncing around in the display window.

Lecture 5: Functions and Libraries.Modular programming is the art and science of breaking a program into pieces that can be individually developed. This lecture introduces functions (Java methods), a fundamental mechanism that enables modular programming. Motivating examples include functions for the classic Gaussian distribution and an application that creates digital music.

Lecture 6: Recursion.A recursive function is one that calls itself. This lecture introduces the concept by treating in detail the ruler function and (related) classic examples, including the Towers of Hanoi puzzle, the H-tree, and simple models of the real world based on recursion. We show a common pitfall in the use of recursion, and a simple way to avoid it, which introduces a different (related) programming paradigm known as dynamic programming.

Lecture 7: Performance.When you develop a program, you need to be aware of its resource requirements. In this lecture, we describe a scientific approach to understanding performance, where we develop mathematical models describing the running time our programs and then run empirical tests to validate them. Eventually we come to a simple and effective approach that you can use to predict the running time of your own programs that involve significant amounts of computation.

Lecture 8: Abstract Data Types.In Java, you can create your own data types and use them in your programs. In this and the next lecture, we show how this ability allows us to view our programs as abstract representations of real-world concepts. First we show the mechanics of writing client programs that use data types. Our examples involve abstractions such as color, images, and genes. This style of programming is known as object-oriented programming because our programs manipulate objects, which hold data type values.

Lecture 9: Creating Data Types.Creating your own data types is the central activity in modern Java programming. This lecture covers the mechanics (instance variables, constructors, instance methods, and test clients) and then develops several examples, culminating in a program that uses a quintessential mathematical abstraction (complex numbers) to create visual representations of the famous Mandelbrot set.

Lecture 10: Programming Languages.We conclude the course with an overview of important issues surrounding programming languages. To convince you that your knowledge of Java will enable you to learn other programming languages, we show implementations of a typical program in C, C++, Python, and Matlab. We describe important differences among these languages and address fundamental issues, such as garbage collection, type checking, object oriented programming, and functional programming with some brief historical context.

Lecture 11: Searching and Sorting.Building on the scientific approach developed in Lecture 7, we introduce and study classic algorithms for two fundamental problems, in the context of realistic applications. Our message is that efficient algorithms (binary search and mergesort, in this case) are a key ingredient in addressing computational problems with scalable solutions that can handle huge instances.

Lecture 12: Stacks and Queues.Our introduction to data structures is a careful look at the fundamental stack and queue abstractions, including performance specifications. Then we introduce the concept of linked structures and focus on their utility in developing simple, safe, clear, and efficient implementations of stacks and queues.

Lecture 13: Symbol Tables.The symbol table abstraction is one of the most important and useful programmer's tools, s we illustrate with several examples in this lecture. Extending the scientific approach of the previous two lectures, we introduce and study binary search trees, a classic data structure that supports efficient implementations of this abstraction.

Lecture 14: Introduction to Theory of Computation.The theory of computation helps us address fundamental questions about the nature of computation while at the same time helping us better understand the ways in which we interact with the computer. In this lecture, we introduce formal languages and abstract machines, focusing on simple models that are actually widely useful in practical applications.

Lecture 15: Turing Machines.In 1936, Alan Turing published a paper that is widely hailed as one of the most important scientific papers of the 20th century. This lecture is devoted to the two far-reaching central ideas of the paper: All computational devices have equivalent computational power, and there are limitations to that power.

Lecture 16: Intractability.As computer applications expanded, computer scientists and mathematicians realized that a refinement of Turing's ideas is needed. Which computational problems can we solve with the resource limitations that are inescapable in the real world? As described in this lecture, this question, fundamentally, remains unanswered.

Lecture 17: A Computing Machine.Every programmer needs understand the basic characteristics of the underlying computer processor being used. Fortunately, the fundamental design of computer processors has changed little since the 1960s. In this lecture, we provide insights into how your Java code actually gets its job done by introducing an imaginary computer that is similar to both the minicomputers of the 1960s and the microprocessor chips found in today's laptops and mobile devices.

Lecture 18: von Neumann Machines.Continuing our description of processor design and low-level programming, we provide context stretching back to the 1950s and discuss future implications of the von Neumann machine, where programs and data are kept in the same memory. We examine in detail the idea that we design new computers by simulating them on old ones, something that Turing's theory guarantees will always be effective.

Lecture 19: Combinational Circuits.Starting with a few simple abstractions (wires that can carry on/off values and switches that can control the values carried by wires), we address in this lecture the design of the circuits that implement computer processors. We consider gates that implement simple logical functions and components for higher-level functions, such as addition. The lecture culminates with a full circuit for an arithmetic/logic unit.

Lecture 20: CPU.In this lecture we provide the last part of our answer to the question "How does a computer work?" by developing a complete circuit for a computer processor, where every switch and wire is visible. While vastly different in scale, this circuit, from a design point of view, has many of the same characteristics as the circuits found in modern computational devices.