Advertisement

Report

darlened3Follow

Feb. 4, 2023•0 likes## 0 likes

•2 views## views

Be the first to like this

Show More

Total views

0

On Slideshare

0

From embeds

0

Number of embeds

0

Upcoming SlideShare

3. recurrence relation

Loading in ... 3

Feb. 4, 2023•0 likes## 0 likes

•2 views## views

Be the first to like this

Show More

Total views

0

On Slideshare

0

From embeds

0

Number of embeds

0

Download to read offline

Report

Education

Let Ti ( mj , N) the cost to solve a significant problem using the mj method. The average cost: Tavg(N) = (1/n) * sum Ti (mj,N), i =1 to n The cost in the worst case: Tworst (N) = max Ti (mj,N), i =1 to n The cost in the best case: Tbest (N) = min Ti (mj, N), i = 1 to n Obviously Tavg (N) Tworst (N). Similarly, Tavg (N) Tbest (N). Is it possible that Tworst = O ( N^2 log N ) and Tworst = (1) , Tavg = O(N^2) , Tavg = (log N) , Tbest = O ( N log N) and Tbest = ( N)? Give a formal proof it\'s IMPOSSIBLE , or give Tworst , Tavg Tbest and FUNCTIONS that meet the conditions. Thank you Solution A function T(N) is O(F(N)) if for some constant c and for all values of N greater than some value n0: T(N) <= c * F(N) The idea is that T(N) is the exact complexity of a method or algorithm as a function of the problem size N and that F(N) is an upper-bound on that complexity (i.e., the actual time/space or whatever for a problem of size N will be no worse than F(N)). In practice, we want the smallest F(N) -- the least upper bound on the actual complexity. For example, consider T(N) = 3 * N2 + 5. We can show that T(N) is O(N2) by choosing c = 4 and n0 = 2. This is because for all values of N greater than 2: 3 * N2 + 5 <= 4 * N2 T(N) is not O(N) because whatever constant c and value n0 you choose, I can always find a value of N greater than n0 so that 3 * N2 + 5 is greater than c * N. Im not familiar with this concept so i cant give you the exact answer, i hope you understand and im sorry. .

darlened3Follow

Advertisement

- Let Ti ( mj , N) the cost to solve a significant problem using the mj method. The average cost: Tavg(N) = (1/n) * sum Ti (mj,N), i =1 to n The cost in the worst case: Tworst (N) = max Ti (mj,N), i =1 to n The cost in the best case: Tbest (N) = min Ti (mj, N), i = 1 to n Obviously Tavg (N) Tworst (N). Similarly, Tavg (N) Tbest (N). Is it possible that Tworst = O ( N^2 log N ) and Tworst = (1) , Tavg = O(N^2) , Tavg = (log N) , Tbest = O ( N log N) and Tbest = ( N)? Give a formal proof it's IMPOSSIBLE , or give Tworst , Tavg Tbest and FUNCTIONS that meet the conditions. Thank you Solution A function T(N) is O(F(N)) if for some constant c and for all values of N greater than some value n0: T(N) <= c * F(N) The idea is that T(N) is the exact complexity of a method or algorithm as a function of the problem size N and that F(N) is an upper-bound on that complexity (i.e., the actual time/space or whatever for a problem of size N will be no worse than F(N)). In practice, we want the smallest F(N) -- the least upper bound on the actual complexity. For example, consider T(N) = 3 * N2 + 5. We can show that T(N) is O(N2) by choosing c = 4 and n0 = 2. This is because for all values of N greater than 2: 3 * N2 + 5 <= 4 * N2 T(N) is not O(N) because whatever constant c and value n0 you choose, I can always find a value of N greater than n0 so that 3 * N2 + 5 is greater than c * N. Im not familiar with this concept so i cant give you the exact answer, i hope you understand and im sorry.

Advertisement