|
|
|
Ask HN: O(n^n) procedure?
|
|
2 points
by cao825
5597 days ago
|
|
I was discussing with some friends at work some of the worst algorithms (in terms of Big O), like Bogo Sort, Stooge Sort, etc... We were trying to think of how one could write a procedure with O(n^n) and all of our attempts ended up being infinite or much less than n^n. I would imagine we just didn't think in the correct terms. Unfortunately, neither Google nor Wolframalpha were any help finding one from my searches. Thanks! |
|
Below is a procedure that generates it. The number of operations is actually sum from k =0 to k =n ( n^(n-k) ) but asymptotically that's still O( n^n ).