CS1050506b - Computer Science Foundation Exam May 5, 2006...

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

View Full Document Right Arrow Icon
1 Computer Science Foundation Exam May 5, 2006 Computer Science Section 1B Name: SSN: Q1 ANL Q2 KNW Q3 ANL,CMP Q4 CMP,ANL Q5 KNW,DSN Q6 CMP Total You have to do all the 6 problems in this section of the exam. Partial credit cannot be given unless all work is shown and is readable. Be complete, yet concise, and above all be neat . KEY
Background image of page 1

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

View Full DocumentRight Arrow Icon
1. [4 pts] It takes 72 ms for an algorithm to execute a task for 8 data elements. When the data size is increased 4 times, the algorithm takes 480 ms. What is the time complexity of the algorithm in terms of big-O? This does not look like O(N). Try if it is O(N 2 ) 8.8 /72 = 32.32/x Yields x = 1152 Now try if it is O(N log N) 8 log 8 /72 = 32 log 32 /x Yields x= 480. Thus the algorithm is O(N logN) [4 points for correct answer, 1 point for getting a wrong answer] 2. [ 6 pts ]Consider the circular array based implementation of a queue with 30 slots. It uses two pointers, front and rear, both set to – 1 when the queue is empty. Indicate the number of EMPTY slots on the queue for following combinations of front and rear indices. If any combination is meaningless indicate so. i) front = 0, rear = 24 ______________ 5 ii) front = 10, rear = 10 _______________ 29 iii) front = – 1, rear = 29 _______________ meaningless iv) front = 29 , rear = 29
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 09/21/2011.

Page1 / 7

CS1050506b - Computer Science Foundation Exam May 5, 2006...

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

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