Exam 2 Review CS 3358 Data Structures
Exam Format 100 Total Points 55 Points Writing Programs 20 Points Tracing Algorithms, determining results, and drawing pictures 25 Points Short Answer Similar to quizzes and programming assignments Note: the point values are approximations
Example Programming Problem Given the ADT for the Stack_3358 at the end of the exam, implement the push, pop, isEmpty and isFull functions.
Example Tracing Problem Given the following array, what would be the contents after the 3rd iteration of an insertion sort? 3 7 2 12 56 1 42 9
Example Short Answer Why is the quick sort less efficient than the insertion sort for small lists (e.g. n < 20)?
Templates 10 Points Why? Templated functions Templated Classes Understand the Stack Fun and List_3358 programs
Analysis of Algorithms (still important) 10 points Don’t memorize definition Does the amount of work depend on the size of the input? Should be able to rank as faster or slower Be able to analyze algorithms and code and determine Big O time analysis Especially most common. O(1), O(n), O(n2), O (log2n) Look for loops How fast does the problem shrink?
Stack ADT 30 points Understand basic functions Push Pop IsEmpty isFull Should be able to implement array or linked list version of stack Be able to use a stack to solve a problem How does a stack relate to recursion? Understand Stack Fun assignment
Queue ADT 15 Points Know the basic functions Enqueue Dequeue isFull isEmpty Be able to implement circular array-based queue Be able to implement a linked list version of a queue
Recursion 25 Points Understand Will have to write a recursive function Base case Smaller caller General case Will have to write a recursive function Be able to do time analysis of a recursive function Understand math stuff and recursive flood fill
Sorting 30 Points Algorithms Time and space considerations O(n2) sorts Will not have to code the sorts Will likely have to draw or trace Time and space considerations O(n2) sorts Selection sort Insertion sort O(nlog2n) sorts Mergesort Quicksort
Not on this exam Hashing Code from book Only concepts covered in class or on assignments
How to Study Review the programs. Rewrite them if you have time (especially the parts you had trouble with) Learn by doing and recognizing patterns. Use the exam for clues on the other problems and for help with syntax. Don’t stay up late!! Get some sleep and eat a good breakfast.
What to bring Pencils and erasers We will provide scratch paper No calculators
Questions