New answers tagged algorithm-analysis
0
votes
Finding growth rate of T(n) of a code segment
Let $I$ be the number of times the for i is executed, $J$ the number of times for j, and $K$ the number of times ...
1
vote
Accepted
Is a predecessor subgraph always connected?
Let $s$ be your source vertex and let $d(v)$ denote the distance from $s$ to $v$. Let $v_1, \dots, v_n$ be the vertices of your graph in non-decreasing order of distances from $s$.
You can show by ...
0
votes
How to prove greedy algorithm is correct
It is great if you can construct cases where the optimal solution is known. In that case generate a million cases and check if they find the expected result.
Or find a mate who implements a different ...
2
votes
How to prove greedy algorithm is correct
There is a very nice theory on when greedy algorithms work in general. It is based on the abstract concept of matroids. A detailed explanation is given by Jeremy Kun.
2
votes
How to prove greedy algorithm is correct
Jeff Ericson in his "Algorithms" states three conditions:
Greedy choice: There is an optimal solution that includes the choice the algorithm makes.
Inductive structure: The smaller ...
Top 50 recent answers are included
Related Tags
algorithm-analysis × 1978algorithms × 959
runtime-analysis × 583
time-complexity × 222
asymptotics × 209
sorting × 158
complexity-theory × 145
graphs × 139
data-structures × 125
recurrence-relation × 98
loops × 85
recursion × 81
search-algorithms × 65
amortized-analysis × 61
correctness-proof × 54
randomized-algorithms × 50
approximation × 44
big-o-notation × 43
average-case × 42
quicksort × 41
arrays × 37
greedy-algorithms × 36
proof-techniques × 35
dynamic-programming × 32
probability-theory × 32