Sample Questions for Quiz 3 CSCI 1902, Spring 2008 This is a set of sample questions for Quiz 3. It is intended to give you a sense of what type of questions to expect on the exam. It also illustrates the different "levels of knowledge" of exam questions. There are several things this set of questions is *not*. (1) It is not a comprehensive list of the topics that may be covered. The best source for that is the lecture notes and the review concepts document. (2) It is not a sample quiz: the set of questions below would take longer than 25 minutes to complete (3) It is not (syntactically speaking) an example of a successful "Quiz Question Proposal"; it contains more questions than necessary and no answers. ============================================================ KNOWLEDGE What is the Big-O efficiency of add (at the end) for an array-based list? ==================== What is the Big-O efficiency of remove(either version) for an array-based list? ==================== What is the Big-O efficiency of contains for an array-based list? ==================== What is the Big-O efficiency of Selection Sort? ==================== What is the Big-O efficiency of Merge Sort? ==================== Order the following time complexities from slowest to fastest: O(n^3), O(1), O(log N), O(2^n), O(n log n) ============================================================ COMPREHENSION & APPLICATION Describe in your own words how Selection Sort works. Describe a specific situation where Bubble Sort is faster than Selection Sort. Draw a picture of a LinkedList of Strings after the following operations have been performed. LList ll = new LList(); ll.add("Joe"); ll.add("Elvis"); ll.add("DeeDee"); ll.add(2, "David"); ============================================================ PROBLEM SOLVING What is the Big Oh efficiency of the method m1? public static int m1 (int[] a) { return m2(a, a.length-1, 0); } public static int m2(int[] a, int i, int s) { if (i < 0) return s; else return m2(a, i-1, s + a[i]); } ==================== What is the Big Oh efficiency of this code snippet? for(int i=0; i