Write an algorithm in pseudocode which takes in a list
(or array or whatever) of n
numbers, and determines whether or not there is a number
that appears more than once in the list. For example,
dups(3,8,5,1,6)
would return false
, but
dups(3,8,5,3,6)
would return true
.
Analyze your algorithm's running time as a function of n. Hint: the problem can be solved in time proportional to n*log(n); for full credit, give an algorithm of this efficiency or better.
Write an algorithm in pseudocode which takes in two binary numbers (represented as lists or arrays of booleans) and adds them, producing the result as another list or array of booleans.
Implement, test, and debug your binary-addition algorithm in your favorite programming language -- C, C++, Java, Scheme, Prolog, perl, Pascal, etc.