Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 13107

Questions about asymptotic notations such as Big-O, Omega, etc.

11 votes

Is $n$ times $O(1)$ equivalent to $O(n)$?

Think in terms of the definition: $f(m)=O(g(m))$ means that there exists some constants $c>0, M\ge 0$ such that $f(m) \le c\cdot g(m)$ for all $m\ge M$ so when you write $$ \sum_{i=1}^nO(1) $$ you mea …
Rick Decker's user avatar
  • 14.9k
1 vote

Papadimitrou and standard landau notation

Here's a hint: we'll show that Definition 1 (the usual definition) implies Definition 2 (Papadimitriou's). Suppose that $f\in\mathcal{O}(g)$, so for some $c, k>0$ we have $f(n)\le c\cdot g(x)$ for al …
Rick Decker's user avatar
  • 14.9k
2 votes

Why does the Θ-class survive adding a constant only for positive, monotonic, and non-decreas...

Let $f(n) = 1-1/n$ and $g(n) = 1/n$, so we've violated the condition that $g$ is non-decreasing. However, it's not hard to show that $f(n) \in O(g(n)+2)$ but we also have $f(n)\notin O(g(n)$, invalida …
Rick Decker's user avatar
  • 14.9k
6 votes
Accepted

Is $\log^2n = O(n)$ or $n = O(\log^2n)$ true?

You're right about the second one, but your reasoning for both is sketchy. The definition of $f(n)=O(g(n))$ is that there exist constants $c,N$ both greater than zero such that $f(n)\le c\cdot g(n)$ f …
Rick Decker's user avatar
  • 14.9k
2 votes
Accepted

Find Big O using Iteration

You're almost there. You correctly have $$\begin{align} T(n) &= T(n-1)+2n\\ &= [T(n-2)+2(n-1)] + 2n = T(n-2)+2(n-1)+2n\\ &= T(n-3)+2(n-2)+2(n-1)+2n\\ &= T(n-4)+2(n-3)+2(n-2)+2(n-1)+2n \ …
Rick Decker's user avatar
  • 14.9k
1 vote

Big O relationship between $n^{10\log n}$ and $(\log n)^n$

[Note: this probably should be a comment, but it's too long and I don't like comments that need to be split over multiple entries.] You need to be a bit careful with these arguments, since it's not a …
Rick Decker's user avatar
  • 14.9k
1 vote

Algorithms - In which relation to the big O notation are the functions lg n and ln n?

Hint: for $a,b>0$ we have $\log_an=(\log_ab)(\log_bn)$.
Rick Decker's user avatar
  • 14.9k
6 votes
Accepted

Asymptotic relationship of logarithms in different bases

We'll show two results. The first is that for any positive constant $k$, we'll have $$ k\cdot f(n) = O(f(n)) $$ To see this, recall what it means for $g(n)=O(f(n))$: this is true when we can find two …
Rick Decker's user avatar
  • 14.9k
4 votes
Accepted

Why add a +1 to the constant proving an O(n) bound?

We want to find a $c$ such that $4+4n\le cn$ for all $n$ greater than or equal to some bound $N$. So we need a $c$ such that $(4+4n)/n \le c$, or $(4/n)+4\le c$. Now while it's true that $$ \lim_{n\ri …
Rick Decker's user avatar
  • 14.9k