What Are the Big-O Notations for n^(n-1) and (n-1)^n?

  • Context: Undergrad 
  • Thread starter Thread starter peterlam
  • Start date Start date
  • Tags Tags
    Notation
Click For Summary
SUMMARY

The big-O notations for the functions n^(n-1) and (n-1)^n are both O(n^n). This conclusion is based on the definition of big-O notation, which indicates that g(x) grows as fast or faster than f(x). While it is correct to state that O(n^(n-1)) = O(n^n), it is important to note that this is not a strict equality but rather a notation indicating asymptotic behavior. There are no simpler upper bounds that are tighter than n^n for these functions.

PREREQUISITES
  • Understanding of big-O notation and asymptotic analysis
  • Familiarity with exponential functions and their growth rates
  • Basic knowledge of mathematical notation and inequalities
  • Experience with algorithm analysis in computer science
NEXT STEPS
  • Research the formal definition of big-O notation and its implications
  • Explore asymptotic analysis techniques for algorithm performance
  • Learn about other common growth rates such as O(n log n) and O(2^n)
  • Investigate tighter bounds for exponential functions in algorithm analysis
USEFUL FOR

Computer scientists, algorithm designers, and students studying computational complexity who seek to deepen their understanding of big-O notation and its application in analyzing algorithm efficiency.

peterlam
Messages
16
Reaction score
0
Hi!

For the following functions, what are their big-O notation?

1. n^(n-1)
2. (n-1)^n

Should their big-O notations be the same as the original functions? i.e.

1. O(n^(n-1)) = n^(n-1)?
2. O((n-1)^n) = (n-1)^n?

Please help!
Many thanks!
 
Physics news on Phys.org
If you look at the definition of big-O notation, it is an asymptotic inequality. Roughly speaking, f(x) = O(g(x)) whenever g grows as fast or faster than f.

In this case, g(x) = nn grows faster than both. So it would be both convenient and correct to say that both are O(nn).

Without more context, it is impossible to say whether this is "good enough" for your purposes.
 
  • Like
Likes   Reactions: 1 person
Thanks! I can understand that O(n^(n-1)) = n^n. But can I say O(n^(n-1)) = n^(n-1)? I am trying to find a tighter asymptotic upper bound.

Similar to the second case.

Thanks!
 
peterlam said:
Thanks! I can understand that O(n^(n-1)) = n^n. But can I say O(n^(n-1)) = n^(n-1)? I am trying to find a tighter asymptotic upper bound.

I have a quibble with the notation you use above. It is correct to say that nn-1 = O(nn). This is not a real equality. It's just a notation. One might loosely read "=O(g)" as "is of order g". It is incorrect to say that O(nn-1) = nn. The latter notation suggests that O() is a function which returns a single function as its value.

I can't think of any upper bounds that are both simpler than nn-1 and tighter than nn.
 

Similar threads

  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 29 ·
Replies
29
Views
4K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 19 ·
Replies
19
Views
4K
  • · Replies 7 ·
Replies
7
Views
3K
Replies
1
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K