DSA Viva Q&ASEM III Lab Externals @vtunetwork
DSA Viva Q&ASEM III Lab Externals @vtunetwork
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 C204.1
BTL1
not only the items stored, but
also their relationships to each other.
BTL 2
C203.1 BTL 1
C203.1 BTL 1
Doubly linked list is a collection of nodes where nodes are
connected by forwarded and
backward link.
Each node has three fields:
1. Address of previous node
2. Data
3. Address of next node.
lists from singly linked lists, the last node’s next field is connected
to the first node.
15 When doubly linked list can be represented as circular linked
list?
In a doubly linked list, all nodes are connected with
forward and backward links to the
next and previous nodes respectively. In order to implement
circular linked lists from
doubly linked lists, the first node’s previous field is connected to
the last node and the
last node’s next field is connected to the first node. C203.1 BTL 1
20 The polynomial equation can be represented with linked list C203.1 BTL 2
as follows:
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
int element;
struct stack *next;
}*top;
8 Write the routine to pop a element from a stack.
int pop()
{ if(top==NULL)
C203.2
{ printf(“\n Stack is empty.\n”);getch();exit(1);} BTL 5
else
{int temp;
temp=top→element; top=top→next; return temp; }}
9 Define queue.
It is a linear data structure that maintains a list of
C203.2
elements such that insertion happens at BTL 1
rear end and deletion happens at front end.
FIFO – First In First Out principle
10 What are the operations of a queue?
The operations of a queue are
● isEmpty()
C203.2
● isFull() BTL 1
● insert()
● delete()
● display()
11 Write the routine to insert a element onto a queue.
void insert(int element)
{
if(front==-1 )
{
front = rear = front +1;
queue[front] = element;
return;
} C203.2
BTL 5
if(rear==99)
{
printf(“Queue is full”);
getch();
return;
}
rear = rear +1;
queue[rear]=element;
}
12 What are the types of queue?
The following are the types of queue:
C203.2
● Double ended queue BTL 1
● Circular queue
● Priority queue
13 Define double ended queue
C203.2
● It is a special type of queue that allows insertion and BTL 1
deletion of elements at both
Ends.
● It is also termed as DEQUE.
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.
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 C203.3
BTL1
no 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
C203.3
BTL2
26 Define a heap. How can it be used to represent a priority
queue?
A priority queue is a different kind of queue, in which the next
C203.3
element to be removed is defined by (possibly) some other BTL1
criterion. The most common way to implement a priority queue is
to use a different kind of binary tree, called a heap. A heap avoids
the long paths that can arise with binary search trees.
27 What is binary heap?
C203.3
It is a complete binary tree of height h has between 2h and 2h+1 -1 BTL1
node. The value of the root node is higher than their child nodes
28 Define Strictly binary tree?
If every nonleaf node in a binary tree has nonempty left and right C203.3
BTL1
subtrees ,the tree is termed
as a strictly binary tree.
29 Define complete binary tree?
C203.3
A complete binary tree of depth d is the strictly binary tree all of BTL1
whose are at level d.
30 What is an almost complete binary tree?
A binary tree of depth d is an almost complete binary tree if :
C203.3
_ Each leaf in the tree is either at level d or at level d-1 BTL1
_ For any node nd in the tree with a right descendant at level d,all
the left descendants of nd that are leaves are at level d.
31 Define AVL Tree.
A AVL tree is a binary search tree except that for every node in C203.3
BTL1
the tree,the height of the
left and right subtrees can differ by atmost 1.
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.
5 Define hashing.
C203.5
Hash function takes an identifier and computes the address of BTL1
that identifier in the hash table using some function
6 What is the need for hashing?
Hashing is used to perform insertions, deletions and find in constant C203.5
BTL1
average time.