Final review page for CS241: Data Structures -- Spring 2013
Disclaimers:
Not all of these questions will appear on the final.
Not all of the questions on the final appear here.
First, make sure you can answer the questions on the midterm review page... especially
if your midterm score was less than satisfying! There will be questions from the first half of the term on the final!
Sample questions from the second half of the course:
Binary tree/ Binary Search Tree
What is the definition of a binary tree?
Given that definition, if you store 3 values in a binary tree, how many binary trees are in it total? How many empty trees?
Write a method, ht, that returns the ht of a binary tree.
Write a method, size, that returns the number of non-null sub trees in a tree
What is the definition of a BST?
What is the definition of a heap?
How does a heap represent the binary tree?
Write pseudocode for tree sort.
Write pseudocode for heap sort.
N-nary tree
What is the definition of an nary tree?
Define an nary tree class
Write a method to traverse an n-ary tree, send toString to each root, and sout it with indentation showing its depth
Write ht and size (see above)
Write pseudocode for displaying an nary tree graphically
Dynamic programming
What the Needleman-Wunsch algorithm?
Write it!
What is the running time?
Why is this called dynamic programming?
Write pseudocode for generating fibonacci numbers using dynamic programming.
Cellular automata
What are the rules of Conway's life?
How to you make the board a torus? Write code!
What's wrong with this loop?
for each cell {
count nbrs
update state
}
Space and time
How can you trade space for time? Give an example.
How can you trade time for space? Give an example.
Write a Board class for tic tac toe that represents the board as a 2D array of ints (1 for X, -1 for O, 0 for empty)
Write a method that is passed a Board and returns a unique int representing that Board.
Finally, here's the final exam I gave the last time I taught cs241.