# Midterm I Review

## Topics Covered

The first midterm for this class will cover the following topics:
• O(), Ω() and Θ()
• Definitions
• Manipulations of expressions containing O, Ω and Θ
• Running time analysis of code examples
• Iterative Code (loops)
• Recursive Code
• Creating a recurrence relation for a piece of recursive code
• Solving the recurrence relation using Repeated Substitution, Recursion Trees, and the Master Method
• Proving bounds using the substiution method
• Stacks, Queues, and Lists
• Using both arrays and linked lists
• Heaps
• Representation of heaps
• Operations (insert / remove min / buildHeap)
• Time bounds
• Binary Search Trees
• Operations (insert / find / remove)
• Time bounds (best / worst / average cases)
• Binary (non-Search) Trees
• Simple tree operations
• Tree traversals (INORDER / PREORDER / POSTORDER)
• General Trees
• Tree representation (left child, right sibling)
• Simple tree operations
• Tree traversals (PREORDER / POSTORDER) (why doesn't INORDER make sense here?)

## Problem Types

You will be expected to solve the followng kinds of problems:
• Given a piece of non-recursive code, find the running time
• Given a piece of recursive code, create a recurrence relation that describes the running time of the piece of code, and then solve the recurrence relation using repeated substituion, recursion trees, or the master method
• Given a recurrence relation and a O() bound, use the substitution method to prove the bound is correct
• Trace through the operation of a particular data structure / algorithm. For instance, insert a specified list of elements into a heap, show the resulting heap, insert a specified list of elements into a binary search tree, show the tree
• Write a small piece of code (on the order of the in-class assignmets)
• Find a bug in a piece of code
• "Thinking Question" -- a question that requires some extra thought, and displays a deeper understanding of the topics.

## How to Study

• Go over homework solutions, be sure that you understand them
• Go over in-class problems, be sure that you understand the solutions
• Go over visualizations, make sure you understand and can trace through all of the algorithms discussed in class
• Read the class notes (printed)