hw1 - Data Structures and Algorithms (CS 130A) Prof. Suri...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
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 fine of $10 for the first day. Each subsequent day, until the city followed the judge’s order, the fine was doubled. (That is, the fine progressed as follows: $10, $20, $40, etc.) (a) (3 pts) What would be the fine on day N ? (b) (3 pts) Given a specific amount D , how many days would it take for the fine to reach D dollars? (A big-Oh answer will do.) (c) (4 pts) Suppose the judge were a bit harsher, and the fine was squared each day, instead of doubled. Then, what would be the fine on day N ? 3. (10 pts) You are given an
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.
Ask a homework question - tutors are online