{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

MidTerm2F08MW

# MidTerm2F08MW - 1/6 EE 322C Fall 2008 Second Mid-Term Dr...

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

1/6 EE 322C Fall 2008 Second Mid-Term Dr. Ramesh Yerraballi MW Class Full Name : Duration : 75 minutes Note: To earn partial credit you have to provide your work and not just give the final answer 1. [ 25 points ] Answer the following i. [ 10 points ] For the typical algorithms that you use to perform calculations by hand, determine the time complexity (big-O) to: [One-line answers will suffice if you are correct] a. [ 3 points ] Add two N-digit integers [Note: 1234 + 2341 is addition of two 4-digit numbers (N=4); You may assume that adding two digits takes a constant time] b. [ 4 points ] Multiply two N-digit integers c. [ 3 points ] Determine whether an N-digit integer is odd or even

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

View Full Document
2/6 ii. [15 points] Consider an array A of length N , where each element of the array is a 0 or a 1 . Describe in pseudo-code (or java if you prefer) a linear-time algorithm to find the Longest Contiguous Sequence of 1 ’s in the array. If there are no 1 ’s in the array then the Longest Contiguous Sequence is zero.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}