Data Structures Theory Answers Modified
Data Structures Theory Answers Modified
Data Structures Theory Answers Modified
M3 To equip students with values, ethics and life skills needed to enrich their lives and
enable them to meaningfully contribute to the progress of society
M4 To prepare students for higher studies and lifelong learning, enrich them with the
practical and entrepreneurial skills necessary to excel as future professionals and
contribute to Nation’s economy
M2 To strengthen the core-competence in computer science and engineering and to create
an ability to interact effectively with industries.
M3 To produce engineers with good professional sKills, ethical values and life skills for the
betterment of the society.
M4 To encourage students towards continuous and higher level learning on technological
advancements and provide a platform for employment and self-employment.
PEO3 Apply ethical Knowledge for professional excellence and leadership for the
betterment of the society.
PEO4 Develop life-long learning skills needed for better employment and
entrepreneurship
SYLLABUS
Abstract Data Type (ADT) - List ADT- Arrays based Implementation-linked list implementation-singly
linked lists-circularly linked lists-doubly linked list-Application of list-polynomial manipulation-all
operations (insertion, deletion, merge, traversal).
UNIT II LINEAR DATA STRUCTURES-STACKS,QUEUES 9
Stack ADT-Operations-applications-Evaluating arithmetic expressions-conversion of infix to postfix
expressions-queue ADT-Operations-circular queue-priority queue-dequeue-applications of queues.
UNIT III NON LINEAR DATA STRUCTURES- TREES 9
C203.1 Implement abstract data type for List linear data structure and apply them to problem
solutions.
C203.2 Implement abstract data type for Stack and Queue linear data structure and apply
them to problem solutions.
C203.3 Implement abstract data type for Tree non List linear data structure and apply them
to problem solutions.
C203.4 Implement abstract data type for Graph non List linear data structure and apply them
to problem solutions.
C203.5 Analyze the various sorting and Searching algorithms and Hashing Techniques.
INDEX
UNIT NO TEXT/ REFERENCE BOOK PAGE
NO
UNIT -I Mark Allen Weiss, “Data Structures and Algorithm Analysis in C”, 2nd 1-50
Edition, Pearson Education,1997.
UNIT -II Mark Allen Weiss, “Data Structures and Algorithm Analysis in C”, 2nd 55-75
Edition, Pearson Education,1997.
UNIT -III Mark Allen Weiss, “Data Structures and Algorithm Analysis in C”, 2nd 85-10
Edition, Pearson Education,1997. 2
UNIT -IV Mark Allen Weiss, “Data Structures and Algorithm Analysis in C”, 2nd 107-1
Edition, Pearson Education,1997. 60
UNIT -V Mark Allen Weiss, “Data Structures and Algorithm Analysis in C”, 2nd 202-2
Edition, Pearson Education,1997. 70
UNIT I
Abstract Data Type (ADT) - List ADT- Arrays based Implementation-linked list implementation-singly
linked lists-circularly linked lists-doubly linked list-Application of list-polynomial manipulation-all
operations (insertion, deletion, merge, traversal).
Course Blooms
S.
Question Outcom Taxanom
No.
e y Level
1 What is a data structure?
● A data structure is a method for organizing and storing
data which would allow efficient
data retrieval and usage.
● A data structure is a way of organizing data that considers C203.1
BTL1
not only the items stored, but
also their relationships to each other.
C203.1 BTL 1
Doubly linked list is a collection of nodes where nodes are C203.1 BTL 1
connected by forwarded and
backward link.
Each node has three fields:
1. Address of previous node
2. Data
3. Address of next node.
20 The polynomial equation can be represented with linked list C203.1 BTL 2
as follows:
Coefficient Exponent Next node link
struct polynomial
{
int coefficient;int exponent;struct polynomial *next;
};
21 What are the operations performed in list?
The following operations can be performed on a list
i. Insertion
a. Insert at beginning
b. Insert at end
c. Insert after specific node
d. Insert before specific node
ii. Deletion C203.1 BTL 1
a. Delete at beginning
b. Delete at end
c. Delete after specific node
d. Delete before specific node
iii. Merging
iv. Traversal
PART-B
1 Explain the various operations of the list ADT with examples C203.1
BTL 2
2 Write the program for array implementation of lists C203.1
BTL 5
3 Write a C program for linked list implementation of list. C203.1 BTL 5
UNIT II
LINEAR DATA STRUCTURES-STACKS,QUEUES
C203.2
BTL 1
STACK QUEUE
Insertion and deletion are made Insertion at one end rear and
at one end. deletion at other end front.
The element inserted last would The element inserted first
be removed first. So LIFO would be removed first. So
structure. FIFO structure.
PART-B
1 Explain Stack ADT and its operations C203.2 BTL5
UNIT III
Blooms
S. Course
Question Taxanomy
No. Outcome
Level
1 Define non-linear data structure
Data structure which is capable of expressing more
C203.3 BTL1
complex relationship than that of physical adjacency is called
non-linear data structure.
2 Define tree?
C203.3
A tree is a data structure, which represents hierarchical BTL1
relationship between individual data items.
3 Define leaf?
C203.3
In a directed tree any node which has out degree o is BTL1
called a terminal node or a leaf.
4 Explain the representations of priority queue. C203.3
BTL2
Using Heap structure, Using Linked List
5 List out the steps involved in deleting a node from a binary
search tree.
1. t has no right hand child node t->r == z
2. t has a right hand child but its right hand child node has no C203.3
BTL1
left sub tree
t->r->l == z
3.t has a right hand child node and the right hand child node
has a left hand child node t->r->l != z
6 Convert the infix expression (A-B/C)*(D/E-F) into a postfix. C203.3
BTL2
Postfix: ABC/-DE/F-*
7 What are the steps to convert a general tree into binary tree? C203.3
BTL1
* use the root of the general tree as the root of the binary tree
* determine the first child of the root. This is the leftmost node
in the general tree at the next
level
* insert this node. The child reference of the parent node refers
to this node
* continue finding the first child of each parent node and insert it
below the parent node with the
child reference of the parent to this node.
* when no more first children exist in the path just used, move
back to the parent of the last node
entered and repeat the above process. In other words,
determine the first sibling of the last
node entered.
* complete the tree for all nodes. In order to locate where the
node fits you must search for the
first child at that level and then follow the sibling references to
a nil where the next sibling can
be inserted. The children of any sibling node can be inserted
by locating the parent and then
inserting the first child. Then the above process is repeated.
What is meant by directed tree?
C203.3
8 ed tree is an acyclic diagraph which has one node called its root BTL1
with in degree o while all other nodes have in degree I.
9 What is a ordered tree?
C203.3
In a directed tree if the ordering of the nodes at each level is BTL1
prescribed then such a tree is called ordered tree.
10 What are the applications of binary tree?
1. Binary tree is used in data processing. C203.3
BTL1
2. File index schemes
3. Hierarchical database management system
11 What is meant by traversing?
C203.3
Traversing a tree means processing it in such a way, that each BTL1
node is visited only once.
12 What are the different types of traversing?
The different types of traversing are
C203.3
a. Pre-order traversal-yields prefix form of expression. BTL1
b. In-order traversal-yields infix form of expression.
c. Post-order traversal-yields postfix form of expression.
13 What are the two methods of binary tree implementation?
C203.3
BTL2
UNIT IV
S. Blooms
Course
N Question Taxanom
Outcome
o. y Level
1 Define Graph?
A graph G consist of a nonempty set V which is a set of
nodes of the graph, a set E which is the set of edges of the graph, C203.4 BTL1
and a mapping from the set for edge E to a set of pairs of elements
of V. It can also be represented as G= (V, E).
2 Explain the topological sort.
It is an Ordering of vertices in a directed acyclic graph such C203.4
BTL1
that if there is a path from vi to vj, then vj appears after vi in the
ordering.
3 Define NP
NP is the class of decision problems for which a given C203.4 BTL1
proposed solution for a given input can be checked quickly to see
if it is really a solution.
4 Define biconnected graph.
C203.4
A connected undirected graph is biconnected if there are no BTL1
vertices whose removal disconnects the rest of the graph.
5 Define shortest path problem?
C203.4
For a given graph G=(V, E), with weights assigned to the BTL1
edges of G, we have to find the shortest path (path length is
defined as sum of the weights of the edges) from any given source
vertex to all the remaining vertices of G.
6 Mention any two decision problems which are NP-Complete.
NP is the class of decision problems for which a given C203.4
BTL2
proposed solution for a given input can be checked quickly to see
if it is really a solution
7 Define adjacent nodes?
Any two nodes which are connected by an edge in a graph are
C203.4 BTL1
called adjacent nodes. For E is associated with a pair of
nodes∈example, if and edge x (u,v) where u, v V, then we say
that the edge x connects the nodes u and v. ∈
8 What is a directed graph? C203.4 BTL1
A graph in which every edge is directed is called a directed graph.
9 What is a undirected graph?
C203.4
A graph in which every edge is undirected is called a directed BTL1
graph.
10 What is a loop? BTL1
C203.4
An edge of a graph which connects to itself is called a loop
or sling.
11 What is a simple graph?
A simple graph is a graph, which has not more than one edge C203.4
BTL1
between a pair of nodes than such a graph is called a simple
graph.
12 What is a weighted graph?
C203.4
A graph in which weights are assigned to every edge is called a BTL1
weighted graph.
13 Define out degree of a graph? BTL1
C203.4
In a directed graph, for any node v, the number of edges which
have v as their initial node is called the out degree of the node v.
14 Define indegree of a graph?
C203.4
In a directed graph, for any node v, the number of edges which BTL1
have v as their terminal node is called the indegree of the node v.
15 Define path in a graph?
C203.4
The path in a graph is the route taken to reach terminal BTL1
node from a starting node.
16 What is a simple path?
C203.4
A path in a diagram in which the edges are distinct is called a BTL1
simple path. It is also called as edge simple.
17 What is a cycle or a circuit?
C203.4
A path which originates and ends in the same node is BTL1
called a cycle or circuit.
18 What is an acyclic graph?
C203.4
A simple diagram which does not have any cycles is called BTL1
an acyclic graph.
19 What is meant by strongly connected in a graph?
An undirected graph is connected, if there is a path from C203.4
BTL1
every vertex to every other vertex. A directed graph with this
property is called strongly connected.
20 When is a graph said to be weakly connected?
When a directed graph is not strongly connected but the C203.4
BTL1
underlying graph is connected, then the graph is said to be weakly
connected.
21 Name the different ways of representing a graph?
C203.4
a. Adjacency matrix BTL1
b. Adjacency list
22 What is an undirected acyclic graph?
When every edge in an acyclic graph is undirected, it is C203.4
BTL1
called an undirected acyclic graph. It is also called as undirected
forest.
23 What are the two traversal strategies used in traversing a graph?
C203.4
a . Breadth first search BTL1
b. Depth first search
24 What is a minimum spanning tree?
A minimum spanning tree of an undirected graph G is a C203.4
BTL1
tree formed from graph edges that connects all the vertices of G at
the lowest total cost.
25 Define topological sort?
A topological sort is an ordering of vertices in a directed C203.4
BTL1
acyclic graph, such that if there is a path from vi to vj appears after
vi in the ordering.
26 What is the use of Kruskal’s algorithm and who discovered it?
Kruskal’s algorithm is one of the greedy techniques to solve the C203.4
BTL1
minimum spanning tree problem. It was discovered by Joseph
Kruskal when he was a second-year graduate student.
27 What is the use of Dijksra’s algorithm?
Dijkstra’s algorithm is used to solve the single-source
shortest-paths problem: for a given vertex called the source in a
C203.4
weighted connected graph, find the shortest path to all its other BTL1
vertices. The single-source shortest-paths problem asks for a
family of paths, each leading from the source to a different vertex
in the graph, though some paths may have edges in common.
28 Prove that the maximum number of edges that a graph with n
Vertices is n*(n-1)/2.
Choose a vertex and draw edges from this vertex to the
remaining n-1 vertices. Then, from these n-1 vertices, choose a C203.4
BTL5
vertex and draw edges to the rest of the n-2 Vertices. Continue this
process till it ends with a single Vertex. Hence, the total number of
edges added in graph is
(n-1)+(n-2)+(n-3)+…+1 =n*(n-1)/2.
29 Define minimum cost spanning tree?
A spanning tree of a connected graph G, is a tree consisting of
edges and all the vertices of G. In minimum spanning tree T, for a
C203.4
given graph G, the total weights of the edges of the spanning tree BTL1
must be minimum compared to all other spanning trees generated
from G. -Prim’s and Kruskal is the algorithm for finding
Minimum Cost Spanning Tree.
30 Define Adjacency in graph.
Two node or vertices are adjacent if they are connected to C203.4
BTL1
each other through an edge. In the following example, B is
adjacent to A, C is adjacent to B, and so on.
31 Define Basic Operations of Graph.
Following are basic primary operations of a Graph
● Add Vertex − Adds a vertex to the graph. C203.4
BTL1
● Add Edge − Adds an edge between the two vertices of the
graph.
● Display Vertex − Displays a vertex of the graph.
32 What is Levels in graph?
Level of a node represents the generation of a node. If the C203.4
BTL1
root node is at level 0, then its next child node is at level 1, its
grandchild is at level 2, and so on.
33 What is visiting and traversing in graph.
● Visiting refers to checking the value of a node when
C203.4
control is on the node. BTL1
● Traversing means passing through nodes in a specific
order.
PART-B
1 Explain the various representation of graph with example in C203.4
BTL2
detail?
2 Define topological sort? Explain with an example? C203.4
BTL5
3 Explain Dijkstra's algorithm with an example? C203.4
BTL5
4 Explain Prim's algorithm with an example? C203.4
BTL5
5 Explain Krushal's algorithm with an example? C203.4
BTL2
6 Write and explain the prim’s algorithm and depth first search
C203.4
algorithm. BTL5