Questions tagged [big-o-notation]
Big O Notation is an informal name of the "O(x)" notation used to describe asymptotic behaviour of functions. It is a special case of Landau notation, where the O is the Greek letter capital omicron. Please consider using the [landau-notation] tag instead if your question is related to small omicron, omega, or theta in Landau notation.
379 questions
1
vote
1
answer
66
views
Big O and Omega, how can they be different for a specific case(worst/best)
So I understand that O is an upper bound and omega is a lower bound. I also understand that case is different than bounds, i.e worst case can have O/Theta/Omega different from best case.
My question: ...
2
votes
1
answer
76
views
Proving the lowest possible time complexity of traversing an array is $O(n)$
How does one go about proving that the lowest possible time complexity for traversing an array is $O(n)$?, it is easy to see that this is the case. But how could I formally prove that this is true?, ...
-1
votes
1
answer
69
views
Why does the big-O for this algorithm not include k?
LeetCode Problem 347. Top K Frequent Elements asks the user to return a list of the $k$ most frequently occurring numbers from a list of numbers. The following solution uses bucket sort:
...
2
votes
4
answers
316
views
Big O arithmetic of tangent
I haven't seen any estimation with big O of tangent, I tried to use limit for the proof, however for it's oscillating behaviour I find it hard to prove that $tan(x)\neq O(2^x)$ where x is all real ...
2
votes
0
answers
73
views
Confusion regarding Big-O definition with multiple variables
I've been scouring around looking for a definition for Big-O when you have multiple input variables.
For context, I'm an undergraduate student.
Wikipedia mentions $$f(\mathbf{x})\text{ is }O(g(\mathbf{...
0
votes
0
answers
97
views
Graph Problem Time Complexity
I'm trying to devise an algorithm for the following prompt from LeetCode's daily challenge:
You are given an undirected weighted graph of n nodes (0-indexed), represented by an edge list where edges[...
2
votes
3
answers
221
views
How to simplify $O(\log (n!))$?
I have a problem with this time complexity: $\log (n!)+\frac{5}{2}n\log\log n$. I'm not sure how to deal with the $n!$ term. I know from calculus class that the sequence $n!$ is bigger than any ...
1
vote
1
answer
83
views
Is $n\log n + n\log \log n = \Theta(\log n)$?
To show $n\log n + n \log(\log n) = \Theta(\log n)$. Is this even correct? It can be easily shown that, $n \log n + n \log(\log n)$ is $O(n\log n)$ and also $\Omega(n\log n)$, with constants $2$ and $...
0
votes
1
answer
131
views
Arora and Barak: Exercise 0.2. (b)
I am reading Arora and Barak's book "Computational Complexity: A Modern Approach". I am doing exercise 0.2. (b): For each of the following recursively defined functions $f$, find a closed (...
2
votes
3
answers
188
views
$f(n)=n^{100}$, $g(n)=2^{n/100}$, determine whether $f=O(g)$
I am reading Arora and Barak's book "Computational Complexity: A Modern Approach". I am doing EXERCISE 0.1.(b): $f(n) = n^{100}$, $g(n)=2^{n/100}$, determine whether $f=O(g)$.
Here's what I ...
1
vote
1
answer
71
views
Emphasizing the Coefficients of the Leading Order and Using Big O Notation for the Remainder
I am trying to understand the correct application of Big O notation to polynomial expressions, including terms with negative coefficients. For example, consider the polynomial $2n^3-2n^2+n+1$, where $...
0
votes
0
answers
35
views
Asymptotic bound
How can this relation : $$ T(n)=4^n + 12 \cdot \sum^{n-2}_{i=1}{T(i)} $$
$$ T(1) = 1 $$
be evaluated to asysmtotic bound (Big O notation)?
It could be easy if the upper bound of the sum were ...
4
votes
2
answers
259
views
How to Determining the Big O Complexity of a Recursive Function?
I'm struggling to determine the correct time complexity of a recursive function from an exam question. The function definition is as follows:
fun (n) {
...
2
votes
2
answers
684
views
Time Complexity O-Notation for Kociemba, Korf, and Thistlethwaite's Algorithms? (Rubik cube)
I'm currently studying the 3x3x3 rubik-cube-solving algorithms developed by Kociemba, Korf, and Thistlethwaite and I'm interested in understanding their computational complexities.
Could someone ...
0
votes
1
answer
181
views
1
vote
0
answers
138
views
What is the difference between $O$ and $\widetilde{O}$?
We know that $\widetilde{O}(f(n))$ — $O$ with a tilde above it — which means $O(f(n) \text {polylog}(f(n)))$, i.e., $O(f(n) (\log f(n))^k)$ for some $k$.
Also I have seen in Wikipedia that $n2^n=\...
2
votes
2
answers
143
views
Big O notation of $O(n/(m-n))$
I'm new to the complexity theory and have a basic question about the big-O notation that I encountered.
I came across a complexity of $O\big(\frac{n}{m-n}\big)$, where both $n$ and $m$ are independent ...
1
vote
1
answer
99
views
Big O, Understanding when the increment is doubling
I am trying to find the Big O notation of this code below, really its the big theta, but whatever I believe its the same in this case.
...
-1
votes
2
answers
136
views
Adding O(x)+O(x-1)+O(x-2)+
I have a function $f$ such that is the sum of big O terms, such as
$$f=\left[\sum_{i=1}^x \frac{1}{i}\right] +O\left(\frac{\ln^4 x}{x}\right)+O\left(\frac{\ln^4 x-1}{x-1}\right)+O\left(\frac{\ln^4 x-2}...
-1
votes
3
answers
269
views
Time complexity of algorithm involving function calls
Me again.
This time I have a more general question.
Suppose I have the following code snippet:
...
0
votes
1
answer
180
views
Find a substring length $k$ with maximum occurrences
Given a string length $S$, find a substring length $k$ that has the most occurrences in the given string.
We want $O(S)$ time complexity in an average case.
I think the solution lies in sophisticated ...
0
votes
1
answer
271
views
Struggling with Recurrence Relation using Telescoping Approach
I have the following recurrence relation that I am trying to solve using the telescoping approach:
$T(n) =
\begin{cases}
T(\frac{n}{4})+ n^2 & \text{for } n \geq 4
\\
1 & \text{otherwise}
\...
0
votes
1
answer
120
views
Why, for $f(n) = n \cdot \sqrt n$ and $g(n)=n^2/\log n$, we have $f(n) = o(g(n))$?
Let $f(n) = n \cdot \sqrt n$ and $g(n)= \frac{n^2}{\log n}$. Why is $f(n) = o(g(n))$?
Could you please explain to me why this is so? I have tried l'Hôpital's rule but it doesn't add any ...
5
votes
5
answers
4k
views
Time Complexity of Linear Search vs Brute Force
I am currently watching the FreeCodeCamp Algorithms and Data Structures Tutorial. In the explanation for exponential time complexity, they explain that using a brute force attack on a combination lock ...
0
votes
3
answers
154
views
How to get a time estimation of an O(n) function to modern multi-core CPU time?
How to get an estimation of an O(n) function to modern multi-core CPU time? For instance, how can I find the time it takes to run an algorithm in a 4-core/8-core CPU when I know its O(n) ? I searched ...