> hey whats up
> could any of you all please help me by posting
> different big 0 runtimes for diferent alogrithms
>
> loops, arrays etc
By the way you might want to read a bit on big O notation first. That way it will make more sense you see the notation for a routine.
> > > > > O(1)
> > > >
> > > > My favorite and the one that people often
> > forget.
> > >
> > > I prefer O(n^0)
> >
> > Only heretics prefer that one.
>
> And the real visionaries are looking at
>
> O(n^-1)
n**-n
>>> O(n^n^n)
>>> O(n^k!)
>> These are equivalent.
> Could you do a proof?
I think he was reading the second as O(n^(n!)) (and the first as O(n^(n^n))). If so, then use Stirling's approximation: lg(n!) ~= n lg n - n. lg(n^n) = n lg n. Therefore as n tends to infinity, n! / n^n tends to 1.
> >>> O(n^n^n)
> >>> O(n^k!)
> >> These are equivalent.
> > Could you do a proof?
>
> I think he was reading the second as O(n^(n!)) (and
> the first as O(n^(n^n))).
Ah yes, I see. That's a 'k' in the second one. Never mind...
Of course, k may be THETA(n)... then there's the problem of grouping.
> >>> O(n^n^n)
> >>> O(n^k!)
> >> These are equivalent.
> > Could you do a proof?
>
> I think he was reading the second as O(n^(n!)) (and
> the first as O(n^(n^n))). If so, then use Stirling's
> approximation: lg(n!) ~= n lg n - n. lg(n^n) = n lg
> n. Therefore as n tends to infinity, n! / n^n tends
> to 1.
My understanding is that to say two functions are O equivalent, there must exist a constant c, such that when c is mutiplied to one of the functions, either function can always be ontop of the other. However, if a graph is made of n! vs n^n, then there is no constant, because the grown of n^n is much faster.
Thus, O(n^(n^n)) != O(n^(n!))
However, assuming the quoted message is correct, then O(lg(n^(n^n))) == O(lg(n^(n!)))
> My understanding is that to say two functions are O
> equivalent, there must exist a constant c, such that
> when c is mutiplied to one of the functions, either
> function can always be ontop of the other.
There are two constants. One that says n^n^n is O(n^n!) and another that says n^n! is O(n^n^n). This means they are asymptotically equivalent.
> However,
> if a graph is made of n! vs n^n, then there is no
> constant, because the grown of n^n is much faster.
No, they grow at the same rate (asymptotically). Stirling's formula roughly says that n! can be bounded above and below by n^n, with suitable multiplicative constants.
>Thus, O(n^(n^n)) != O(n^(n!))
>
> However, assuming the quoted message is correct,
> then O(lg(n^(n^n))) == O(lg(n^(n!)))
Then O(2^(lg(n^(n^n)))) == O(2^lg(n^(n!)))
andO(n^(n^n)) == O(n^(n!))
> My understanding is that to say two functions are O equivalent, there must exist a constant c, such that when c is mutiplied to
> one of the functions, either function can always be ontop of the other.
Your understanding has a subtle flaw. f(n) = O(g(n)) <=> EXIST N, c : FORALL x > N : f(X) <= cg(X).