260 likes | 264 Views
This review guide provides an overview of the final exam format for .EE.312, covering topics such as writing programs, tracing code, short answer questions, and multiple choice. It also includes example programming problems and covers fundamentals of C, pointers, structures, linked lists, stacks and queues, Linux commands, command line arguments, algorithm analysis, object-oriented programming, templates, trees, recursion, searching and sorting, and hashing.
E N D
Exam Format • 165 Total Points • 50 Points Writing Programs • 45 Points Short Answer • 35 Points of Tracing Code • 35 Multiple Choice • All point values are approximations
Example Programming Problems • Compare two linked lists to see if they are equal. • Write a recursive function to find the largest value in a BST. • Write the code to overload the == operator for the UtPod (You would be given the signature.)
Example Short Answer • Explain why traversing a linked list of nodes is an O(n) operation. • Is the following (code would be given) a reasonable way to implement a Stack? • Explain a reasonable way to choose the pivot for a quicksort if you do not know the relative order of the elements in the data? • Draw a BST after the following elements have been added: (12, 34, 22, -3, 42, 17) • What is the Big O time for inserting an item into a complete binary search tree?
What will the EXACT output of the following program be? intfoo = 9; int *ptr = &foo; float foo2 = 5.7; *ptr = 2; foo2 = foo - foo2; if (foo > foo2) printf("Hello!\n“); else if (foo < foo2) printf(“%f\n”, foo2); else printf(“%d\n”, foo); printf(“\n”); printf (“foo2 is %f\n”, foo2);
Fundamentals of C • ?? Points • Declaration of variables and functions • Looping and conditional statements • While, for, if • One and two dimensional arrays • Simple I/O • Printf, scanf, fscanf, fgets
Pointers • 5 Points • A pointer is a variable that holds the address of a memory location • Declaration • int *ptr; • Assignment • ptr = &foo; //& is the address function • Dereferencing • *ptr = 54; //same as foo=54; • You can point to any kind of data type • Relationship between arrays and pointers • Understand the “malloc” and “free” commands
Structures • 10 Points • Declaration • Assignment • Use of the “.” operator • Pointers to structures • (*ptr).field • ptr->field • Structures used in Linked Lists
Linked Lists • 30 Points • Declaring a linked list • Adding a node to a linked list • Removing a node from a linked list • Traversing a linked list • What is the order of magnitude of each of the above operations? • Understand the Stack312_ll code and the linked list code from class.
Stacks and Queues • 6 Points • Operations • makeStack • Push • Pop • isEmpty • isFull • FIFO vs LIFO • Know how to use in a problem and implement • Understand the Stack Fun! assignment
Linux • 6 Points • Know the basic commands you needed to complete a program in Linux • Know how to edit a file in Linux • Know how to compile and run a C program in Linux • Know how to create directories and move around the Linux file system
Command Line arguments • 0 Points • Make sure you understand how to use argc and argv • Understand the use of atoi(char *)
Algorithm Analysis • 25 Points • Understand what Big O notation is • Be able to look at an algorithm or piece of code and determine how much work it has to do (and then the Big(O) analysis of the code) • Understand the relative speed of the Big O orders. • Which is faster? O(1) or O(n)
Object Oriented Programming • 45 Points • Class structure • Instance and Class variables • Instance and Class functions • Understand Constructors and Destructors • Default and overridden • How and when they are called • Calling instance functions • How to override relational operators and why they are necessary for container classes.
OOP, STL,Templates (cont.) • Templated Classes and Functions • You will not have to write any template code. • How to use vectors. • Understand the UtPod and Go Fish programs.
Trees • 25 Points • Definitions • Terminology: path, depth, height, etc. • General Trees vs. Binary Trees • Tree Traversals • Preorder • Inorder • Postorder • Binary Search Trees
Trees (cont.) • Binary Search Tree • Insert • Delete • Find • Count Nodes • Be able to code anything from BST_312 • Make sure you understand the recursive and iterative solutions for each function.
Recursion • 10 Points • Understand • Base case • Smaller caller • General case • Will have to write a recursive functions • Be able to do time analysis of a recursive function • Understand math stuff, recursive flood fill and the BST programs.
Searching and Sorting • 20 Points • Algorithms • Will not have to code the sorts or searches • Know the algorithms REALLY WELL! • Will likely have to draw, trace, or produce psuedo-code • Time and space considerations • Linear Search • Binary Search • O(n2) sorts • Selection sort, Insertion sort • O(nlog2n) sorts • Mergesort, Quicksort
Hashing • 15 Points • Hash tables • Hash Functions • Using strings as keys • Collisions • Separate chaining • Open Addressing • Linear probing • Quadratic probing • Double Hashing • Be able to hash a list of keys given a function and collision strategy
Priority Queues • 5 Points • Can be implemented as a heap • Know the algorithms • enQueue • deQueue • Be able to figure out Big O analysis of operations
Heaps • 6 Points • Definitions • Full binary tree • Complete binary tree • Array-based implementation of binary trees • Parent-child relationships • Calculations to find nodes • Heap property • ReheapDown, ReheapUp
HeapSort • 0 Points • Basic Algorithm • Transform array items into heap • Get smallest item and reheap until heap is empty • Big O analysis
How to Study • Rewrite all the programs. • Concentrate on the last four. • Look at all the data structures and algorithms and see how much work each operation involves with the different implementations of the algorithms for figuring out the Big O questions. • Don’t memorize C or C++! Code syntax will be on the exam. • Learn by doing and recognizing patterns. • 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