Chapter 9
Graph Algorithms
A number of graph problems use Depth First Search as the starting point. Since it
runs in linear time, it is efficient as well. A DFS yields two distinct numbering of the
ve
mywbut.com
3.1 Asymptotic notation
The notations we use to describe the asymptotic running time of an algorithm are defined in terms of
functions whose domains are the set of natural numbers N = cfw_0
Models of Computation
mywbut.com
1
Models of Computation (RAM)
a)
b)
c)
d)
e)
f)
g)
Random Access Machines
Straight Line Programs and Circuits
Vector Machines
Turing Machines
Pointer Machines
Decision
mywbut.com
2.3 Designing algorithms
There are many ways to design algorithms. Insertion sort uses an incremental approach: having sorted the
subarray A[1 j - 1], we insert the single element A[j] into
mywbut.com
Chapter 2:
2.1 Insertion sort
We start with insertion sort, which is an efficient algorithm for sorting a small number of elements. Insertion
sort works the way many people sort a hand of p
mywbut.com
2.2 Analyzing algorithms
Analyzing an algorithm has come to mean predicting the resources that the algorithm requires.
Occasionally, resources such as memory, communication bandwidth, or co
Chapter 4
Optimization II :
Dynamic Programming
Let us try to solve the knapsack problem using a somewhat different strategy. Let
Fi (y) denote the optimal solution for a knapsack capacity y and only