+ it all done 4 Supposo that it takes 0.004 seconds to run a on a test data prog
ID: 3883667 • Letter: #
Question
+ it all done 4 Supposo that it takes 0.004 seconds to run a on a test data program set of size n = 200 , Assume that the number of items in the actual data sot is 4000· What Hould be the expected run-time (show your Hor k) If the progras is applied to the actual data set and the under lying algorithm is: s Assume that it takes 0.0012 seconds to run a program on a test data s-t of size n = 50, Assume that the number of items in the actual cata set is 80,000. What would be the expected run-time (show your work) if the program is applied to the actual data set and the underlying algor ithn is 0(n) b. o( n a· 6. Assune that an algorithm consists of two parts, one part is O(n) and tho other is o(n). What is the Big-o run-time for the entire algor ithm ? 7. The Paradox of Speed: Suppose that computers become 16 times faster If the same amount of computer time is to be used, how müch can the data set size be increased if the underlying algorithm is a. O( n b. O(n) 8. Determine the answer and explain why it is the answer: a. 0( n) 0(n) ? b. 0(n) + 0(n ) = c. 0( log n) o(n)?Explanation / Answer
Encapsulation is the process of binding data and method in a single unit For example Capsule which is a mixture of different medicine
Implementation an ADT means providing one method for each abstract operation. We know that C++, Java support ADT.
Time and Space effeciency
7) Initially the data size was lets say n , when computer became 16 times faster it would process the data 16 times faster i.e 16n
Initially the data size was lets say n2 , when computer became 16 times faster it would process the data 16 times faster i.e 16n2
6) The Big O of entire algorithm is O(n) + O(n2) = O(n2)
8) a. O(n) + O(n) = O(n)
b . O(n) + O(n2) = O(n2)
c . O(log n) + O(n) = O(n)
4) 0.004 seconds for n=200 , time taken for n = 4000 will be
x = 0.004 * 4000/200 = 0.08 seconds
0.004 seconds for n=200 , time taken for n = 4000 will be
x = 0.004 * 4000/200 = 0.08 seconds
Time taken will be 0.08 seconds * 0.08 seconds = 0.064
Determine the big O
1. Selection Sort : O(n2)
2. Insertion Sort : O(n2)
3. Binary Search : O(log n)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.