Re: [algogeeks] BIG O

2012-10-31 Thread jai gupta
is O(long n!) n! is O(n^n) by sterling approximation hence it is O(log n^n) = O(nlogn) On Sun, Oct 28, 2012 at 11:14 PM, Pralay Biswas pralaybiswas2...@gmail.comwrote: @ Siddharth : Well, here is how you may understand it: 1) There is an outer loop that runs n times. (k) 2) Then there is an

Re: [algogeeks] BIG O

2012-10-31 Thread rahul sharma
Its nlogn dude On Wed, Oct 31, 2012 at 8:03 PM, jai gupta jaigupt...@ymail.com wrote: is O(long n!) n! is O(n^n) by sterling approximation hence it is O(log n^n) = O(nlogn) On Sun, Oct 28, 2012 at 11:14 PM, Pralay Biswas pralaybiswas2...@gmail.com wrote: @ Siddharth : Well, here is

Re: [algogeeks] BIG O

2012-10-28 Thread Siddharth Malhotra
Can somebody explain how it is O(n log n). What is the significance of while loop in the above code? I understand that the for loop implies O(n),does the log n in the O(n log n) comes from the while loop? What if there where two while loops in the for loop separately? On Sat, Oct 27, 2012 at

Re: [algogeeks] BIG O

2012-10-28 Thread bharat b
while loop : logj base 2 .. == log1 + log2 + ... logn = log(n!) [since logab = loga + logb] == O(log(n^n)) = O(nlogn) On Sun, Oct 28, 2012 at 3:56 AM, Siddharth Malhotra codemalho...@gmail.comwrote: Can somebody explain how it is O(n log n). What is the significance of while loop in the above

Re: [algogeeks] BIG O

2012-10-28 Thread Pralay Biswas
@ Siddharth : Well, here is how you may understand it: 1) There is an outer loop that runs n times. (k) 2) Then there is an inner loop where j is initially set to current k, but it halves itself in every iteration -- So for example, if k is 32, and j halves every time, then the inner

Re: [algogeeks] BIG O

2012-10-27 Thread CHIRANJEEV KUMAR
O(log( n! )); On Sat, Oct 27, 2012 at 6:03 AM, payal gupta gpt.pa...@gmail.com wrote: That 's correct. On Sat, Oct 27, 2012 at 3:25 AM, rahul sharma rahul23111...@gmail.comwrote: for k=1 to n { j=k; while(j0) j=j/2; } the complexity is big o is o(nlogn) am i ryt -- You

Re: [algogeeks] BIG O

2012-10-27 Thread anil sahu
Yes, its complexity is O(nlogn). On Sat, Oct 27, 2012 at 2:35 PM, CHIRANJEEV KUMAR cse.chiranj...@gmail.comwrote: O(log( n! )); On Sat, Oct 27, 2012 at 6:03 AM, payal gupta gpt.pa...@gmail.com wrote: That 's correct. On Sat, Oct 27, 2012 at 3:25 AM, rahul sharma

Re: [algogeeks] BIG O

2012-10-27 Thread Pralay Biswas
Yes! On Fri, Oct 26, 2012 at 2:55 PM, rahul sharma rahul23111...@gmail.comwrote: for k=1 to n { j=k; while(j0) j=j/2; } the complexity is big o is o(nlogn) am i ryt -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

[algogeeks] BIG O

2012-10-26 Thread rahul sharma
for k=1 to n { j=k; while(j0) j=j/2; } the complexity is big o is o(nlogn) am i ryt -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email