Professional Documents
Culture Documents
Abstract Data Types (ADTs) – List ADT – array-based implementation – linked list
implementation –singly linked lists- circularly linked lists- doubly-linked lists – applications of lists
–Polynomial Manipulation – All operations (Insertion, Deletion, Merge, Traversal).
Tree ADT – tree traversals - Binary Tree ADT – expression trees – applications of trees – binary
search tree ADT –Threaded Binary Trees- AVL Trees – B-Tree - B+ Tree - Heap – Applications of
heap.
Searching- Linear Search - Binary Search. Sorting - Bubble sort - Selection sort - Insertion sort -
Shell sort – Radix sort. Hashing- Hash Functions – Separate Chaining – Open Addressing –
Rehashing – Extendible Hashing.
Total = 45 Periods
TEXT BOOKS:
1. Mark Allen Weiss, “Data Structures and Algorithm Analysis in C”, 2nd Edition, Pearson
Education, 1997.
2. Reema Thareja, “Data Structures Using C”, Oxford University Press, 2011
REFERENCES:
1. Thomas H. Cormen, Charles E. Leiserson, Ronald L.Rivest, Clifford Stein, “Introduction to
Algorithms", Second Edition, Mcgraw Hill, 2002.
2. Aho, Hopcroft and Ullman, “Data Structures and Algorithms”, Pearson Education,1983.
3. Stephen G. Kochan, “Programming in C”, 3rd edition, Pearson Ed.,
4. Ellis Horowitz, Satraj Sahni, Susan Anderson- Freed, “Fundamentals of Data Structures in C”,
Second Edition, University Press, 2008.
Sub.Code PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2 PSO3 PSO4
C203.1 2 2 1 1 0 1 0 0 2 1 1 2 2 2 1 1
C203.2 2 2 2 1 0 0 0 1 1 1 1 2 2 2 2 1
C203.3 2 2 2 2 1 1 1 0 2 1 2 2 2 2 2 2
C203.4 2 2 2 3 1 1 0 1 1 1 2 2 2 2 2 2
C203.5 3 3 3 2 2 1 1 0 2 1 2 2 3 3 2 2
7. R,U Dequeue
2. U Types of graph
6. U,Ap Bi-connectivity
8. Ap Open Addressing
9. Ap,E Rehashing
list.
17 How is an element of a linked list called? What will it contain? C203.1 An
Linked list or list is an ordered collection of elements. Each element in the
list is referred as a node. Each node contains two fields namely,
❖ Data field
❖ Link field
18 What is free pool? C203.1 R
The computer maintains a list of all free memory cells. This list of available
space is called the free pool.
19 List out the disadvantages of linked lists. C203.1 U
❖ It consumes more space because every node requires a additional pointer to
store address of the next node.
❖ Searching a particular element in list is difficult and also time consuming.
St. Joseph’s Institute of Technology Page 3 of 30
CS8391- Data Structures Department of IT 2020-2021
20 Give the comparison between array and linked list.(Nov 18) C203.1 U
Array Linked list
Size of an array is fixed. Size of a list is not fixed.
Memory is allocated from stack. Memory is allocated from heap.
It is necessary to specify the number of It is not necessary to specify the
elements during declaration (i.e., during number of elements during
compile time). declaration (i.e., memory is
allocated during run time).
It occupies less memory than a linked list It occupies more memory.
for the same number of elements.
Inserting new elements at the front is Inserting a new element at any
potentially expensive because existing position can be carried out easily.
elements need to be shifted over to make
room.
Deleting an element from an array is not Deleting an element is possible.
possible.
21 List out the advantages of linked lists. (May 14,15) C203.1 U
Linked lists have many advantages. Some of the very important advantages
are:
❖ Linked lists are dynamic data structures. i.e., they can grow or shrink
during the execution of a program.
❖ Linked lists have efficient memory utilization. Here, memory is not
pre-allocated. Memory is allocated whenever it is required and it is de-
allocated (removed) when it is no longer needed.
❖ Insertion and Deletions are easier and efficient. Linked lists provide
flexibility in inserting a data item at a specified position and deletion of
the data item from the given position.
❖ 4. Many complex applications can be easily carried out with linked
lists.
22 What are the types of Linked Lists? C203.1 R
Singly Linked List, Circular Linked List, Doubly Linked List and Circular
Doubly Linked List.
23 What is singly Linked List? C203.1 R
A single linked list is one in which all nodes are linked together in some
sequential manner. Hence, it is also called as linear linked list. A singly linked
list allows traversal of data only in one way.
34 What are the advantages of circular linked list over linear linked list? C203.1 U
The major advantage of circular lists (over non-circular lists) is that they
eliminate some extra-case code for some operations (like deleting last node).
Also, some applications lead naturally to circular list representations. For
example, a computer network might best be modeled using a circular list.
35 List three operations possible for general list that are not allowed for C203.1 U
either stacks or queues?
Linked list are more flexible in regard to insertion and deletion and
rearrangement
❖ Inserting a new entry at any position
❖ Delete a data at any position
❖ Retrieve data at any position
✓
St. Joseph’s Institute of Technology Page 13 of 30
CS8391- Data Structures Department of IT 2020-2021
40 What are the different ways to implement priority queue? C203.2 R
❖ Linked Representation of a Priority Queue.
❖ Array Representation of a Priority Queue
41 How to implement priority queue using a linked list? C203.2 R
When a priority queue is implemented using a linked list, then every node of
the list will have three parts:
(a) The information or data part,
(b) The priority number of the element, and
(c) The address of the next element.
42 What are multiple queues? C203.2 R
Multiple queues mean to have more than one queue in the same array of
sufficient size.
43 Difference between stack and queue C203.2 U
Stack Queue
A Stack Data Structure works on A Queue Data Structure works on
Last In First Out (LIFO) principle. First In First Out (FIFO) principle.
A Stack requires only one reference A Queue requires two reference
pointer. pointers.
A Stack is primarily a vertical A Queue is a horizontal
representation of data items. representation of data items.
A Stack contains TOP as its A Queue
reference for data processing. contains REAR and FRONT as its
reference for data processing.
Adding operation in the stack is Removing element in the stack is
called as PUSH. called as POP.
Removing element in the stack is Removing element in the queue is
called as POP. called as dequeue.
The way recursive system call System interrupt is a good example
works, it uses Stack mechanism. where queue mechanism is used
44 List out the applications of queues. C203.2 R
❖ Queues are widely used as waiting lists for a single shared resource like
printer, disk, CPU.
❖ Queues are used to transfer data asynchronously (data not necessarily
received at same rate as sent) between two processes (IO buffers), e.g.,
pipes, file IO, sockets.
❖ Queues are used as buffers on MP3 players and portable CD players, iPod
playlist.
❖ Queues are used in Playlist for jukebox to add songs to the end, play from
the front of the list.
❖ Queues are used in operating system for handling interrupts. When
programming a real-time system that can be interrupted, for example, by a
mouse click, it is necessary to process the interrupts immediately, before
proceeding with the current job. If the interrupts have to be handled in the
order of arrival, then a FIFO queue is the appropriate data structure.
B C
D E F G
B C
D E F G
10 State the properties of a Binary Tree. C203.3 R
❖ Maximum No. of nodes on level n of a binary tree is 2^(n-1),where n>=1.
❖ Maximum No. of nodes in a Binary tree of height is 2^(n-1),where n>=1.
❖ For any non-empty tree,nl=nd+1 where nl is the number of leaf nodes and
nd is the no. of nodes of degree 2.
11 What are the different ways of representing a Binary Tree? C203.3 R
❖ Linear Representation using Arrays.
❖ Linked Representation using Pointers.
12 Define Traversal. C203.3 R
Traversal is an operation which can be performed on a binary tree is visiting all
the nodes exactly once.
❖ In order: traversing the LST, visiting the root and finally traversing the
RST.
❖ Preorder: visiting root, traversing LST and finally traversing RST.
❖ Post- order: traversing LST, then RST and finally visiting root.
13 Define Threaded Binary tree. C203.3 R
A Threaded Binary Tree is a binary tree in which every node that does not have
a right child has a THREAD (in actual sense, a link) to its INORDER
successor. By doing this threading we avoid the recursive method of traversing
a Tree, which makes use of stacks and consumes a lot of memory and time.
17 Draw the expression tree for the given postfix expression using stack. C203.3 Ap
AB*C+
1 2
*
A B A B
3
4
C +
*
A B
C
*
A B
Inorder Traversal – 1 2 3 4 5 6 7 9
33 For the tree in Figure . (a) List the siblings for node E ( b)Compute the height. C203.3 Ap
(Nov 18)
a b
a b
a b
a
e
a
c d
a a
The path from ‘a’ to ‘e’ are P1 = ((a,b),(b,e)) P2 = ((a,c),(c,d),(d,e))
12 What is a cycle or a circuit? C203.4 R
A path which originates and ends in the same node is called a cycle or circuit.
A cycle is a path where the last vertex is adjacent to the first. A cycle in which
no vertex repeats (such as 1-2-3-1 versus 1-2-3-2-1) is said to be simple.
13 What is an acyclic graph? C203.4 R
A simple diagram which does not have any cycles is called an acyclic graph.
An acyclic graph does not contain any cycles. Trees are connected acyclic
undirected graphs. Directed acyclic graphs are called DAGs.
14 What are the two traversal strategies used in traversing a graph? C203.4 R
❖ Breadth First Search
❖ Depth First Search
15 When is a graph said to be weakly connected? C203.4 R
When a directed graph is not strongly connected but the underlying graph is
connected, then the graph is said to be weakly connected.
18 What are the different ways to represent graph ?(Dec 14, C203.4 R
May 16, Nov 18)
Two ways of representing a graph are:
❖ Adjacency matrix
❖ Adjacency list
19 List the two important key points of depth first search. C203.4 R
❖ If path exists from one node to another node, walk across the edge
exploring the edge.
❖ If path does not exist from one specific node to any other node,
return to the previous node where we have been before –
backtracking.
20 What do you mean by breadth first search (BFS)? C203.4 U
The breadth first traversal is a graph search algorithm that begins at root node
and explores all the beginning nodes. Then for each of those nearest nodes, it
explores their unexplored neighbor nodes and so on, until it finds the goal.
21 Define Shortest path problem. C203.4 R
For a given graph G=(V, E), with weights assigned to the 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
22 What is Bi- connectivity in graph? C203.4 R
❖ A connected undirected graph is bi-connected if there are no vertices
whose removal disconnects the rest of the graph.
❖ If the nodes are computers and the edges are links, then if any computer
goes down, network mail is unaffected, except, of course, at the down
computer. Similarly, if a mass transit system is bi-connected, users always
have an alternate route should some terminal be disrupted.
23 What is Euler path and Euler circuit? (Nov 18) C203.4 R
❖ An Euler path is a path that uses every edge of a graph exactly once. An
Euler path starts and ends at different vertices.
❖ An Euler circuit is a circuit that uses every edge of a graph exactly once.
An Euler circuit starts and ends at the same vertex.
24 What is topological sorting (Dec 15) C203.4 R
Topological or topological ordering of a directed graph is a linear ordering of
its vertices such that for every directed edge u v from vertex u to vertex v, u
comes before v in the ordering.
St. Joseph’s Institute of Technology Page 24 of 30
CS8391- Data Structures Department of IT 2020-2021
25 What is cut- vertex (or) what is an articulation point? C203.4 R
❖ If a graph is not bi-connected, the vertices whose removal would
disconnect the graph are known as articulation points.
❖ These nodes are critical in many applications. The graph in following
Figure is not bi-connected: C and D are articulation points. The removal of
C would disconnect G, and the removal of D would disconnect E and F,
from the rest of the graph
11 Consider a directed acyclic graph 'D' given in following graph. sort the nodes C203.4 R &Ap
of 'D' by applying topological sort on 'D' (Dec 14)
Linear search requires O(n)times Binary search is very best in time and
efficiency. It requires O(log n)times
12 Write an algorithm for binary search with an example.(Nov/Dec 19) C203.5 R &Ap