Sample_exam2 - COP 3502 Computer Science I Exam#2(Monday...

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

View Full Document Right Arrow Icon
COP 3502 – Computer Science I Exam #2 – 7/7/08 (Monday) Name : ______________________________ 1) (5 pts) An O(n 2 ) algorithm takes 2 ms. to run on an input size of n = 50. On another input size, the algorithm took 72 ms. to run, what was that input size? 2) (8 pts) Determine the following sum in terms of n: + = - 3 15 5 2 n i i . 3) (5 pts) What is the run-time (order) of the following code segment in terms of n? for (i=0; i<n; i++) { for (j=0; j<i; i++) { sum += j; } }
Background image of page 1

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

View Full DocumentRight Arrow Icon
4) (5 pts) What is the run-time (order) of the following code segment in terms of n? i=0, j=0; j++; i++; } 5) (5 pts) What is the run-time (order) of the following code segment in terms of n? i=0, j=0; j=0; j++; i++; }
Background image of page 2
6) (7 pts) Evaluate the following postfix expression and show the state of the operand stack at the indicated points: a b c 3 5 7 + 8 4 / / 3 5 + * Final Value : _____________ 7) (10 pts) Convert the following infix expression to postfix and show the state of the
Background image of page 3

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

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

This note was uploaded on 09/22/2010 for the course EECS COP 3502 taught by Professor Guha during the Spring '09 term at University of Central Florida.

Page1 / 8

Sample_exam2 - COP 3502 Computer Science I Exam#2(Monday...

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

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