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

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

View Full Document Right Arrow Icon
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)). g)
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/06/2010 for the course CS COMP250 taught by Professor Blanchette during the Fall '09 term at McGill.

Page1 / 4

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

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online