Review for Final Andy Wang Data Structures, Algorithms, and Generic Programming

advertisement
Review for Final
Andy Wang
Data Structures, Algorithms,
and Generic Programming
Final Exam (Wed 12/3)
• 25%: Lectures 1 - 7
• 25%: Lectures 8 - 15
• 50%: Lectures 16 - 22
Strings and BitVectors
• Three characteristics of a
proper type
• Two major advantages of C++
strings over C strings
• How to set/unset/test nth bit in
a char
Hash functions and
templates
• Hash functions
• Description
• Properties
• Three design principles for
hashing a sequence of keys
• Implement simple template
classes/functions
Search Algorithms
• Definition of invariants
• Big “O” notation (worst case
running time)
Linked Lists and Deques
• List vs. vector vs. deque
• Implement list operations
• Why multiple iterators for a
given class
• pContainers vs. aContainers
• How to compute the size of a
deque and why
Stacks and Queues
• Implement of DFS and BFS in
pseudo code
• How to implement a queue with
a stack
• How to implement a stack with
a queue
Function Objects and
Generic Algorithms
• Advantages of function objects
• Implement generic copy, find,
max, sort
• Running time of generic sort
Iterators and Generic
Set Algorithms
• Types of iterators and when to
use what
• Conceptual understanding of
set operations
• Implement union, intersection,
difference, containment, merge
Sets and Maps
• How to use set operations to
find out words not in a
dictionary
• How to use sets to implement
maps
• How to use maps to implement
linked lists and trees
Trees 1
• Definitions: graph, tree, depth,
leaf, binary tree, complete
binary tree, partially ordered
tree, heap
• Traversals: preorder,
postorder, levelorder, inorder
• How to use nodes listed in
different orders to uniquely
identify a tree
Trees 1
• Total number of vertices in a
complete binary tree
• Total number of leafs in a
complete binary tree
• What if we have a complete trinary tree?
Trees 1
• How to use a vector to
represent a complete binary
tree
• How do you access parent, left
child, and right child?
• Heap operations
• Push (bottom up)
• Pop (top down)
Trees 1
• Heap operations
• Push (bottom up)
• Pop (top down)
Trees 2
• Tree navigators vs. iterators
• For a complete binary tree,
which node is the first node for
an inorder traversal? Which
node is the last?
Trees 2
• For a complete binary tree,
which node is the first node for
a preorder traversal? Which
node is the last?
Trees 2
• For a complete binary tree,
which node is the first node for
a postorder traversal? Which
node is the last?
Trees 2
• For a complete binary tree,
which node is the first node for
a levelorder traversal? Which
node is the last?
• How to implement a levelorder
binary tree iterator
Trees 3
• How to store a tree in a file
• How to perform node insertion
and removal
Trees 4
• Definition: totally ordered tree
• How to perform a binary tree
with a binary search tree
• Best and worst running time of
binary search via a binary
search tree
Trees 4
• How to improve the average
running time of binary search
via a binary search tree
Download