CS250-Final-2003

# CS250-Final-2003 - NAME STUDENT NUMBER Question 1(30 points...

This preview shows pages 1–2. Sign up to view the full content.

1 COMP 250-A Deferred and supplemental final examination NAME: STUDENT NUMBER: . DEFERRED AND SUPPLEMENTAL FINAL EXAMINATION COMP-250 A – Introduction to Computer Science School of Computer Science, McGill University April 15 th 2004, 14:00-17:00 Examiner: Mathieu Blanchette INSTRUCTIONS Write your name at the top of this page. Answer directly on exam paper Two blank pages are added at the end in case you need extra space. This examination is worth 50% of your final grade. The total of all questions is 100 points. The value of each question is found in parentheses next to it. This is an open book exam though sharing materials with other students is not permitted. No calculator or laptop computer, cell phones, etc. is allowed. This exam comprises 13 pages, including the cover page. All logs are in base 2. SUGGESTION: READ ALL THE QUESTIONS BEFORE YOU START! THE NUMBER OF POINTS IS NOT ALWAYS PROPORTIONAL TO THE DIFFICULTY OF THE QUESTIONS. SPEND YOUR TIME WISELY! GOOD LUCK! Grading scheme: 1. / 30 2. / 6 3. / 10 4. / 16 5. / 12 6. / 13 7. / 13 Total. / 100 2 COMP 250-A Deferred and supplemental final examination Question 1: (30 points, 2 points each) True or False Specify whether the following statements are true or false. Give a two-line justification for each. Credits will be given only if the justification is correct. a) If f(n) is O(h(n)) , then 2 f(n) is O( 2 h(n) ) b) n + sin (n ) is O( 10 + cos(n) ) c) If an algorithm A runs in time O(n log n) and an algorithm B for the same problem runs in time O(n 2 ), then for any n> 0, there must exists an input of size n on which algorithm A is faster than algorithm B . d) Although many sorting algorithms have average-case running time O (n log n), they all have worst-case running time O(n 2 ). e) You have a small computer with a memory that can store at most 1000 integers. Then, it might be better to sort an array of 900 integers using selectionSort than using mergeSort (as implemented in class). f) Suppose a hash table has K buckets, the buckets are dictionaries implemented with a balanced binary search tree, and the hash table contains a total of N elements. Then, under the best possible choice of hash function, any find(key) operation will take time O(N/K log (N/K)).

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern