strategies suggested in the texthoor (b) By using amortized time to analysis bot
ID: 3728855 • Letter: S
Question
strategies suggested in the texthoor (b) By using amortized time to analysis both strategies, which one has better result? o.S (4) (1.5 point) (a) if the running time of an Algorithms T(n) is T(n) 3n +5 n what would the O(g(n) of the asymptotic growth rate function becomes for a large n? Lxto 3 3 -0. (e it incre us e very ra?;dly if large n value (b) Give a big-O characterization, in terms of n, of the running time of following code. public static int bigo(int Il first, intllsecond) int n = first. length; int count :0; for (int i 0; in; i++)f int total =0; for (int j 0 jn; j++) kExplanation / Answer
We cannot solve part b as the strategies nor the text book was not given.
4a) Any value of n that is greater than 1. But as the Time Complexity is O(n^4) as it is the upper limit.
Hence that is the value of n
b)O(n^3) is the time complexity.
for(i=0;i<n;i++) runs for n times
for(j=0;j<n;j++) runs for n times
for(k=0;k<j;k++) runs atmost for n times.
Hence total Complexity is n^3
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.