Data Structures and Algorithms (CS 130A) Prof. Suri Homework Assignment 1 Handed Out: Jan 6 Due: Jan 13 1. (10 pts) Suppose T 1 ( n ) = O ( g ( n )) and also T 2 ( n ) = O ( g ( n )). Which of the following are true? Explain your answer. (a) T 1 ( n ) + T 2 ( n ) = O ( g ( n )). (b) T 1 ( n )-T 2 ( n ) = o ( g ( n )). (c) T 1 ( n ) /T 2 ( n ) = O (1). (d) T 1 ( n ) = O ( T 2 ( n )). 2. (10 points) In a court order case, a judge cited a city for contempt and ordered a ﬁne of $10 for the ﬁrst day. Each subsequent day, until the city followed the judge’s order, the ﬁne was doubled. (That is, the ﬁne progressed as follows: $10, $20, $40, etc.) (a) (3 pts) What would be the ﬁne on day N ? (b) (3 pts) Given a speciﬁc amount D , how many days would it take for the ﬁne to reach D dollars? (A big-Oh answer will do.) (c) (4 pts) Suppose the judge were a bit harsher, and the ﬁne was squared each day, instead of doubled. Then, what would be the ﬁne on day N ? 3. (10 pts) You are given an
This is the end of the preview. Sign up
access the rest of the document.