Computer Science 60
Study Guide for the Final Exam
Spring 1999
Below is study guide to help you prepare for the final exam. In addition
to using this guide, we strongly recommend carefully reviewing your class notes
and homework assignments.
Approximately 60 percent of the exam will cover material
after the second midterm and the other 40 percent will cover the rest of the
material in the course.
You may bring an 8.5 by 11 sheet of paper to the exam with anything you want
handwritten on one side of the sheet. In addition, you should bring a
calculator to the exam. You will need to compute logarithms for some of the
algorithm analysis problems.
The final exam for Section 1 (Mon/Wed section) is on Tuesday, May 11 from
2-5 PM. The final exam for Section 2 (Tue/Thurs section) is on Friday, May 14
from 2-5 PM. Students in Section 2 are welcome to take the exam with the
Section 1 students if desired.
- Object-oriented Programming in Java
- What is a constructor and when is it invoked?
- What does this refer to in a java class?
- What do private and public mean and where is
it appropriate to use each of them?
- What is static and where and why would it be used?
- What is the difference between deep copy and shallow copy and
what are the advantages and disadvantages of each?
- What is inheritance, why is it useful, and how does it work?
- What is an abstract class and why is it useful?
- Big Oh
- What does Big Oh mean informally? Why are we interested in a
definition like this?
- What is the formal definition of Big Oh?
- How do you use the "generous" method with the formal definition
to prove that one function is big Oh of another?
- Know how to prove the properties of logarithms (those that we saw
in class and on the homework).
- What is the height of a perfectly balanced binary tree with n nodes?
Make sure that you can prove this formally.
- Why does the height of a binary tree with n nodes remain O(log n)
even if some large fixed fraction of the nodes (say 90%) always goes on one
side of the tree and the remaining nodes go on the other? Be able to
prove this.
- Why are self-balancing trees important to us and what's the very
general idea? (No need to know the specific rules for rotating, etc.)
- Abstract Data Types (ADT's) and Data Structures
- What is an ADT and what is a data structure?
- What are the ADT's Dictionaries, Queues, Stacks, and Priority Queues?
(What operations does each ADT support?)
- How are function calls handled by the operating system using
a stack? Why does this make recursion very simple to handle?
- How do breadth-first search and depth-first search work? How are
queues and stacks used in each of these algorithms? How can recursion
be used to implement depth-first search without explicitly using a
stack?
- How do extendible arrays, bit vectors, linked lists, binary trees,
and heaps work? In particular, make sure that you could write code for
all of these data structures including the more challenging ones such as
inserting and finding data in a binary tree and inserting and extracting
the maximum in a heap. Make sure that you understand how to delete from
a binary tree (we won't ask for code!).
- For each ADT above, which data structures could be used to implement
it? Make sure that you can analyze the big-Oh running time of any
operation for any given data structure above.
For example, if we used an unsorted
linked list to implement a Priority Queue, you should be able to
explain why insert would take O(1) time but extracting the maximum would
take O(n) time.
- How does heapsort work? How can an array be used here in place of
a binary tree? Be able to derive the big Oh running time
of this clever sorting algorithm. How does it compare to the running time
of selection sort?
- Functional Programming in rex
- Make sure that you understand and feel comfortable with
rex's syntax.
- Make sure that you can write basic rex functions like those
developed in lecture and on Assignment 6. In particular, recursion
is the secret to all happiness in functional programming. How can you
take a problem and formulate it using recursion?
- What is a function and what is a predicate?
How can a function take a function as an argument? How can
a function return a function as an argument? What are anonymous
functions and where are they useful?
- How can objects such as arrays, trees, and graphs be encoded
as lists? Make sure that you feel comfortable writing rex functions
to manipulate such objects.
- How is breadth-first search implemented in rex?
- What is the difference between normal order and applicative order?
What are the merits of each?
- Make sure that you understand the concepts of delayed evaluation
and infinite lists.
- What is tail recursion and why is it important?
- Logic Programming
- Prolog "programs" are a collection of facts and rules. Make
sure that you understand the examples that we saw in class.
- What is "backtracking"? How does it work in Prolog?
- Dynamic assertions: What are they and why do we need them?
- Computer Architecture
- Logic gates: What do they do?
- How can the minterm expansion principle be used to design
an arbitrary circuit? Why do AND, OR, and NOT gates suffice?
- How do S-R latches and D-latches work?
- What is a RAM and how does it work?
- How does a CPU work? Specifically, what is the IP (or PC),
what is the IR, and what are registers? What are the five basic
operations that occur for each instruction and how does the
corresponding circuitry work?
- What is an "assembly language"? How is it related to the
computer's own "machine language"? What does an assembler actually do?
What are "assembler directives"?
- How are function calls and recursion implemented in assembly language?
- Finite Automata
- What is a deterministic finite automaton (DFA)? What does the
name mean? What do the states in a DFA attempt to model in a real
computer? What does the input tape in a DFA attempt to model?
What is the definition of a regular language?
- Feel comfortable building a DFA for a given regular language.
Remember that the states can encode meaningful information about
what the machine has seen so far.
- Are all finite languages (languages with a finite number of strings)
regular? Why?
- What does "distinguishable" mean? What does "pairwise
distinguishable" mean?
- What does the Distinguishability Theorem state? How can it be
used to prove that a specific DFA has the minimum possible number of
states for the language that it accepts? How did we prove the
Distinguishability Theorem?
- What does the Nonregular Language Theorem state? How can it
be used to prove that a given language is not regular? How did
we prove this theorem?
- What is an NFA? What does it mean for an NFA to accept a string?
- We showed that NFA's are no more powerful than DFA's in the sense
that any NFA can be automatically converted into a DFA that accepts
the same language. Be able to explain how this works and make sure
that you can perform this conversion process.
- What is a regular expression? Why are regular expressions useful?
How can a regular expression be converted into an epsilon-NFA?
- How can you use DFA's to build circuits with memory (such as
a digital lock)?
- Computability and Turing Machines
- Know the proofs that the "halting problem" is unsolvable if
there is unbounded (or unknown) amount of memory and is solvable
otherwise.
- Make sure that you understand the corresponding proofs for
the "minlength" problem.
- What is a Turing Machine? What is the Church-Turing Hypothesis?
- Which model of computation more closely models a real computer:
A DFA or a Turing Machine? Why?
- Algorithm Analysis
Last modified April 1999 hadas@cs.hmc.edu