Dear vbforum
I'm having trouble doing these question please help, I have try to do it, but I don’t know is right or not. Please any smart people out there, show me the step to do it.
Thank You!
Please help.VB Code:
----------------------Question Q1)Algorithm A uses 50n log n operations, algorithm B uses n^2 operations. Determine the value of n such that A this better than B for N >= n . Log(n) is base10 for A. Q2)Suppose we are comparing implementations of insertion sort and merge sort on the same machine. For inputs of size n, insertion sort runs in 8(n^2), while merge sort runs in 64n lg n steps. For which values of n does insertion sort beat merge sort? Q3)What is the smallest value of n such that an algorithm whose running time is 100 n2 runs faster than an algorithm whose running time is 2n on the same machine? Q4) 2. Prove that f(x) = 10 + 100lg(x-3) is Big-omega 3. Prove that f(x) = 10 + 100lg(x-3) is Big-O ---------------------- ----------------------Answer I don’t ready know what do it mean by A beat B, I hope I get the arrow right. Q1) A B 50nlog(n) <= n^2 50nlog(n) <= n^2 ---------- ---- n n 50log(n) <= n n=1 try it out 50log(1) <= 1 0 <= 1 0<=n<=1 Q2) 8n^2 >= 64nlgn 8n^2 >= 64nlgn ------ -------- n n 8n >= 64lgn 8n >= 64lgn ---- -------- 8 8 n >= 8lgn n >= lg(n^8) 2^n >= n^8 Try to guess n = 0 2^0 >= 0^8 1 >= 0 Yes n=1 2^1 >= 1^8 2 >= 1 Yes n=2 2^2 >=2^8 4 >= 256 No I think 0 <= n <= 1 Q3) 100n^2 <= 2^n Don’t know what to do, try to guess n = 1/10 100(1/10)^2 <= 2^(1/10) 100(1/100)^2 <= 2^(1/10) 1 <= 2^(1/10) 1 <= 1.07 0 <= n <= 1/10 Q4) No Idea, can some one please show step for Big-omega & Big-O? ----------------------




Reply With Quote