Questions tagged [analysis-of-algorithms]
Questions concerning estimations of the amount of time and space used by an algorithm. Approximate recurrence relations are considered. For exact recurrences use [tag:recurrence-relations] or [tag:functional-equations].
156 questions
0 votes
1 answer
49 views
Prove Big Theta for degree p polynomial
Goal Prove that $f(n) = a_pn^p + a_{p-1}n^{p-1} + ... + a_1n + a_0$ is $\Theta(n^p)$ Issue I am having trouble proving $f(n)$ is $\Omega(n^p)$. I know I need a $c_0$ and $k$ such that $f(n) \ge c_0n^p$...
0 votes
0 answers
136 views
Is my proof of $T(n) = T(n - 1) + n$ being $O(n^2)$ correct?
I know that this has been posted at least once, but the accepted solution doesn't use the substitution method laid out in Introduction to Algorithms by Thomas Cormen. What I've tried so far is this: $...
4 votes
1 answer
146 views
Is there a common notation for tightest big-O and big-Omega order?
Lets take the function $f(x) = x + (x^2-x)\frac{1+\sin{7x}}{2}$. This function oscillates between $x$ and $x^2$. So it is $O(x^2)$ and $\Omega(x)$ and these are the tightest upper and lower bounds. ...
0 votes
0 answers
37 views
Is there a characterization of growth rates that are "regularly behaved"?
Assume every function is eventually nonnegative. In other words, we are interested in growth rates for measuring time complexity and such. $f = O(g)$ is equivalent to $\limsup \frac{f}{g} < \infty$,...
2 votes
1 answer
114 views
How does this algorithm for finding prime numbers work? [closed]
Robert C. Martin in his book "Clean Code" presents an algorithm for finding prime numbers present in Knuth's book. After some cleanup the algorithm looks like the following (in C#): ...
1 vote
1 answer
121 views
How to solve an infinite recurrence relation of this form?
How to solve a recurrence relation of this form? $$ a_n = \sum_{i=0}^{n-1} a_{i}a_{n-1-i}(1-\frac{i}{n}), a_0=1 $$ Other information: Because of the symmetric structure inside the summation, it can ...
1 vote
1 answer
124 views
Maximum Sum of Products NP Complete
I'm working on the following problem: You have a multiset of $3N$ nonnegative real numbers $S$. You must partition this set into $N$ triples. The goal is to maximize the sum of the products of each ...
0 votes
0 answers
32 views
Why doesn't the greedy heuristic give the optimal solution for file storage?
I'm working on a problem where I need to store $n$ files of sizes $f_1, f_2, \ldots, f_n$ on a hard disk. The disk is divided into segments, each of size ( K ). The problem has the following ...
-1 votes
1 answer
95 views
Explain the steps needed to solve this recurrence by guess and check method
My teacher showed us this recurrence for merge sort, and solved it using guess and check. I don't understand the steps he is taking to simplify and factor the equation. T(n) = 2T(n/2) + n we guess ...
-1 votes
1 answer
131 views
Find the dominating term
I know that, $$a+b=\Theta(\max\{a, b\}).$$ I need to understand the dominating term in this expression, $$\mathcal{O}(m^{\frac{2}{3}}n^{\frac{2}{3}}+m+n).$$ We know that,$$m^{\frac{2}{3}}n^{\frac{2}{...
1 vote
1 answer
82 views
Shortest path through vertex in weighted graph (Proof)
I'm currently studying several classic graph algorithms for shortest paths (Dijkstra, Bellman-Ford, etc.) and came to the following problem: Problem We have $G:=(V,E,\omega)$, a weighted, connected, ...
1 vote
0 answers
66 views
Feeling this proof that $\log_b(n)$ is $O(n)$, where b is any positive real number $\neq 2$, has an error.
From Rosen's Discrete Math textbook, I feel the part of the proof where they say $$\log_b n = \frac{\log_2 n}{\log_2 b} < \frac{n}{\log_2 b}$$ where $b$ is any positive number not equal to $2$ is ...
0 votes
1 answer
87 views
Is there a closed form method of expressing the *content* of integer partitions of $n$?
I know that the question of a closed form for the number of partitions of $n$, often written $p(n)$, is an open one (perhaps answered by the paper referred to in this question's answer, although I'm ...
0 votes
2 answers
96 views
Interpreting an algorithm as an integral
$\text{Consider the following algorithm:}$ ...
0 votes
0 answers
40 views
Proving inequality $y_0 \leq \dots \leq y_n \leq y_{n+1} \leq \sqrt{a} \leq \dots \leq x_{n+1} \leq x_n \leq \dots \leq x_n$
I want to calculate $\sqrt{a}, a \in \mathbb{R^+}$ with the following algorithm: $y_n = \frac{a}{x_n}$, $x_{n+1} = \frac{y_n+x_n}{2}, n=0,1,\dots,$, with a start value $x_0 \geq \sqrt{a}$. Now there ...