O(n^4)....
Just think...
for(i = 0; i < n; i++)
for(j = 0; j < i; j++)
has Time Complexity O(n^2)
then how come for(i = 0; i < n; i++)
for(j=0; j<i*i; j++)
it's O(n^2)..
it's...1 + 2^2 + 3^2 + ...n^2 which is O(n^3)
but adding one for(k=0; k < j; k++) will not make it n^5
it will be 1+ (1+4) + (1+4+9)...
which is sum(O(n^3))
hence time complexity is O(n^4)
On Sat, Sep 10, 2011 at 1:19 PM, Brijesh <[email protected]>wrote:
> i==>n
> j==>i*i= n*n
> k==>j=i*i=n*n so total i*j*k=n^5
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/jv1X4YzDp_sJ.
>
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.