Lab Exercise -10
1. Write a menu driven program showing following operations in a
binary tree
- Insertion
- Deletion
Inorder, preorder and Postorder Traversal
2. Write a menu driven program showing following operations in a
binary Search tree
- Insertion

SINGLE-SOURCE SHORTEST PATH
PROBLEM
Single-Source Shortest Path Problem - The problem of
finding shortest paths from a source vertex v to all other
vertices in the graph.
DIJKSTRA'S ALGORITHM
Dijkstra's algorithm - is a solution to the single-source
short

Polynomial Representation
typedef struct nodeType cfw_
int coeff;
int power;
struct nodetype *next;
node;
node *poly;
Coeff
of the
term
Power of Link
x
to
next
node
A=3x14+2x8+1
A
3
14
2
8
1
0
NULL
-3 10
10
6
NULL
B=8x14-3x10+10x6
B
8
14
Sparse Matrix
A

Outline
Graph Adjacency Representation
Topological Sort
Minimum Spanning Tree
Kruskals Algorithm
Prims Algorithm
1
Graph - adjacency representation
Adjacency matrix
A B C D E
B
A 0 0 1 0 1
C
D
B 0 0 0 1 0
C 0 1 0 0 0
D 0 0 1 0 0
E 0 0 1 1 0
A
E
G = (

Graphs
1
Definition of Graphs and
Related Concepts
Representation of Graphs
Graph Traversal
Definition of Graphs
2
A graph is a finite set of nodes with
edges between nodes
Formally, a graph G is a structure (V,E)
consisting of
a finite set V called the

List Implementation using Linked Lists
Linked list
Linear collection of self-referential class objects, called
nodes
Connected by pointer links
Accessed via a pointer to the first node of the list
Link pointer in the last node is set to null to mark the l

Queues
1
The Queue data structure
The queue
insert
insert
insert
remove
(returned)
remove
(returned)
length
front
(returned)
FIFO: First-In-First-Out
2
Definition:
data structure in which the elements are
added at one end, called the rear, and
deleted fr

Pointers and Arrays in C
An array name by itself is an address, or pointer in C.
In general, a pointer is a variable that assumes
addresses as values.
An array name is a particular fixed address that can
be thought of as a fixed or constant pointer.
Wh