finalexamcs1 - COP 3502 Computer Science I Final Exam...

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

COP 3502 – Computer Science I Final Exam – 7/28/08 (Monday) Name : ______________________________ 1) a) (3 pts) Convert 10110111 2 to decimal. ______________________ b) (3 pts) Convert 113 10 to binary. ______________________ c) (4 pts) Determine the following sum in terms of n: = - n n i i 2 1 2 , for positive integers n. _______________________

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

View Full Document
2) (10 pts) Write a recursive function that takes in an integer array, its length, and a number, and determines the how many times the number appears in the array. Fill in the prototype given below. int numTimes(int values[], int length, int number) { } 3) a) (5 pts) An algorithm runs in O( n ) time. When the algorithm is run with an input size of 14900, it takes 7 seconds to complete. How long will it take to complete on an input size of 59600?
b) (5 pts) What is the (worst-case) run-time of the following segment of code in terms of n? Assume all variables are declared and initialized as integers. Please give a Big-Oh bound and a proper justification for your answer. for (i=0; i<n; i++) {

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.

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 / 9

finalexamcs1 - COP 3502 Computer Science I Final Exam...

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

View Full Document
Ask a homework question - tutors are online