{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Assignment2A - 4 Yes you can always estimate the running...

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

View Full Document Right Arrow Icon
Data Structures Assignment #2 Jennifer Kim Chapter 2 1. If N>=n0 wasn’t a requirement, the Big-O of a function could be a number of things. The Big-O of a function has to be at least  greater or equal to the lowest term of the function.  2. As the value of N increases, if you are looking at the big picture, 3N and 2N’s growth rate isn’t that much different because they  are both linear functions. The definition of Big-O includes greater or equal to. 3. f1(10) = 20. f1(20) = 40. f2(10) = 30. f2(20) = 60. I noticed that for f1, the difference was 20 and for f2, the difference was 30. The difference isn’t that big. 
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 4. Yes you can always estimate the running time of an algorithm in Big-O term so it’s easier to have an idea of how fast the running time is without wasting time on calculating the exact run time. 5. n! grows faster. The rate of growth is greater for n! compared to 2^n 6. a. O(n^5) b. O(5^n) c. O(n) d. O(n) e. O(n^2) 7. There is one for loop so the running time is O(n) 8. There is one for loop so the running time is O(n) 9. There are two for loop so the running time is O(n^2) 10. There is one for loop so the running time is O(n)...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online