1/6
EE 322C Fall 2008 Second MidTerm
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 (bigO) to:
[Oneline answers will suffice if you are correct]
a.
[
3 points
] Add two Ndigit integers
[Note: 1234 + 2341 is addition of two 4digit numbers (N=4); You may assume
that adding two digits takes a constant time]
b.
[
4 points
] Multiply two Ndigit integers
c.
[
3 points
] Determine whether an Ndigit 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 pseudocode (or java if you prefer) a lineartime 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.
 Spring '08
 NETTLES
 Big O notation, Analysis of algorithms, Computational complexity theory, Dr. Ramesh Yerraballi

Click to edit the document details