The algorithms must be written for the
responsibilities
Knowledge responsibilities usually just return
the contents of one of an object’s variables
Action responsibilities are a little more
complicated, often involving calculations
Design and Analysis of Algorithm
15

16
Trace the algorithm on the input given.

17

18
A path in a
multigraph that
traverses all the edges exactly once
and returns to a starting vertex.
Such paths are called
Eulerian
circuits
;
if a path traverses all the edges
exactly once but does not return to its
starting vertex, it is called an
Eulerian path
.

Euler proved that an
Eulerian circuit
exists
in a connected (multi)graph if and only if all
its vertices have even degrees, where the
degree of a vertex is defined as the number of
edges for which it is an endpoint.
Eulerian path
exists in a connected
(multi)graph if and only if it has exactly two
vertices of odd degrees; such a path must
start at one of those two vertices and end at
the other.
19

Fundamental Data Structures
Linear Data Structures
Graphs
Trees
Sets and Dictionaries
20

Linear Data Structures
21

Assume you have a single linked list with a forward
pointer at each node as shown in the following
diagram.
Assume you are given a pointer of a node somewhere
in the liked list as shown in the figure.
How one can implement the delete
p
th
node operations
in such a way that the time it takes does not depend on
the array’s size n or it does not depend where p is in
the list.
22
p

Graphs
23

Weighted Graphs
Paths & Cycles
Graph Traversal
24

Trees
25

Rooted Trees
26

Sets & Dictionary
27

Solve Exercise 1.4
28
Assignment # 3

#### You've reached the end of your free preview.

Want to read all 28 pages?

- Fall '19