Assignment 1, due Jan 28
Part of
the homework for 22C:60, Spring 2005
|
Always, on every assignment, please write your name legibly as it appears on your University ID and on the class list! All assignments will be due at the start of class on the day indicated, and unless there is what insurance companies call "an act of God" - something outside your control; the only exceptions to this rule will be by advance arrangement.
a) Given a set S of n distinct items, how many distinct subsets of S are there, including the empty set and also including S itself.
b) Given an array A containing n items sorted in ascending order, how many array elements must be examined in order to determine if one of the array elements contains the integer value i? Assume a binary search algorithm, and identify the worst case.