DSD-Question Bank
DSD-Question Bank
QUESTION BANK
Year/Sem:I/II
UNIT-I
PART-A
1
ii) Circular Linked Lists(Circular-singly&Circular-doubly
LinkedLists).
Non-Linear DataStructures
i) Trees ii) Graphs.
Operations such as insertion and deletion Insertion and deletions are easier and needs
are ineffective since the memory locations only one pointer assignment.
need to be moved up and down
respectively.
3
PART-B
1. Design a routine to delete an element in a linkedlist.
2. Develop an algorithm for insertion operation in a singly linkedlist.
3. Describe in detail about Polynomial manipulation in linkedlist.
4. What is a linked list? Describe the suitable routine segments for any four operations.
5. Examine the algorithms to implement the doubly linked list and perform allthe
operations on the createdlist.
6. Identify the array implementation of list and show all itsoperation.
7. Discuss the creation of a doubly linked list and appending the list.Give relevant codingin
C.
8. Write C code for singly linked list with insert, delete, display operations usingstructure
pointer.
9. Differentiate single linked list and doubly linked list with anexample.
10. Explain the application of linked list indetail.
11. Analyze and write C code for circular linked list with create, insert,delete, display
operations.
12. Explain the various operations of the list ADT withexamples.
13. Analyze the doubly linked list and circular linked list. Mention its advantages and
disadvantages.
14. Explain the steps involved in insertion and deletion into a singly linkedlist.
15. Recommend an algorithm to add two polynomials when the polynomialsare
represented singly linkedlists.
16. Compose an algorithm toReverse the elements of a single linked list,count the number of
nodes in a given singly linked list. Searching the element from linkedlist.
17. Given an list 10,20,30,40 generalizethe steps to delete a node from the beginning of the
linked list, deletion of last node in adeletion of middle node in alist.
18. Develop a C program to split a linked list into sub lists containing odd and even ordered
elements in themrespectively.
4
UNIT-II
PART-A
1. Definestack?
Stack is an ordered collection of items into which new items may be inserted and from
which items may be deleted at one end, called the top of stack.
2. Define CircularQueue.
In array based implementation of queue, inefficiency arises only when the value of the rear
pointer exceeds maximum size during insertion. This can be rectified if we logically consider the
queue to be circular.
In circular queue, once the rear pointer reaches the maximum size, the next location I the first
one (index 0), provided the first location is vacant. The specific location is calculated by mod
(%)operator.
STACK QUEUE
Insertion and deletion are made at one end. Insertion at one end rear and deletion at
other end front.
The element inserted last would be The element inserted first would be
removed first. So LIFO structure. Removed first. So FIFO structure.
Full stack condition: Full stackcondition:
If(top==Maxsize) If(rear = =Maxsize)
Physically and Logically full stack Logically full. Physically may or may not
be full.
5. Define De-queue.
A de-queue is an ordered list in which additions and deletions may be carried out at either end.
10. What are the limitations in the stack, when array used as home ofstack?
The Array is finite collection of elements and in stack the number of elements is
unlimited. As the stack dynamically changes the attempts to insert more elements than the
array size cause overflow
12. What are the error conditions that could occur in stack implementation? How
could they berectified?
Overflow
Underflow
To avoid overflow, the stack should be checked whether it is full or not before every push
operation.
To avoid underflow, the stack should be checked for emptiness before every
pop operation.
16. DefineQueue?
A queue is an ordered collection of items from which items may be inserted at one end
called rear end and into which items may be deleted at the other end called the front end.
17. Why Queue is called FIFO list?
In a queue, the first element inserted at rear end will be the first element to be deleted at
front end. So, queue is called First-in First-out list.
6
18. What are the basic operations that could be performed on a Queue?
Insertion – insert (q, x) inserts x at the rearend.
Removal – x=remove (q) remove the element in front end.
Empty(q) – Checks whether queue has any elements or not.
19. What are the limitations of linear queue? How they can berectified?
When an element is removed from linear queue, the location remains unused. Even if the
queue is empty, new elements cannot be inserted. To avoid this, consider queue as a circle,
having the first element immediately following the last element.
23. What are the limitations in priority queue? How it could berectified?
Deletion of elements makes a location empty. The search of items includes the empty
spaces too. This takes more time. To avoid this, use an empty indicator or shift elements forward
when each element is deleted. We can also maintain priority queue as an array of ordered
elements, to avoid risk in searching.
7
PART-B
a. Trace the algorithm to convert the infix expression “3-(4/2) +(1*5) + 6” toa
postfix expression using stack.
b. Show the simulation using stack for the following expression toconvert infix to
postfix :p*q+(r-s/t).
7. Explain how to evaluate the following arithmetic expressions usingstacks.
a. 6 5 2 3 + 8 * + 3 + *2 3 1 * + 9 -
8. Briefly describe the operations of queue withexample.
9. Describe about implementation of queue ADT using linked list. Give relevant examples
and diagrammaticrepresentations.
10. Discuss and write a C program to implement queue functions usingarrays.
11. Explain application of queue with suitableexample.
12. Explain circular queue and itsimplementation.
13. Analyze the implementation of priorityqueue.
14. Prepare an algorithm to perform the operations in a double ended queue.Develop aC
program for linked list implementation ofstack.
15. A circular queue has a size of 5 and has 3 elements 10,20 and 40 where F=2 and
R=4.After inserting 50 and 60,what is the value of F and R.Trying to insert 30 at this
stage what happens? Delete 2 elements from the queue and insert 70, 80 & 90.Assessthe
sequence of steps with necessary diagrams with the value of F &R.
16. Generalize and develop a function to insert an element into a queue and delete an
element from a queue, in which the queue is implemented as a linkedlist.
8
UNIT-III
PART-A
1. Define Tree.
A Tree is a collection of one or more nodes with a distinct node called the root , while
remaining nodes are partitioned as T1 ,T2, ..,Tk , K≥ 0 each of which are sub trees, the edges of
T1,T2,…,Tk are connected the root.
9
8. Define a full binary tree.
A full binary tree is a tree in which all the leaves are on the same level and every non-leaf
node has exactly two children.
10
19. What are the tasks performed during in-ordertraversal?
Traverse the leftsubtree
Process the rootnode
Traverse the rightsubtree.
Ex :A+B
21. Give the pre & postfix form of the expression (a +((b*(c-e))/f).
32. What are the two alternatives that are used to construct aheap?
The two alternatives to construct a heap are
Bottom-up heapconstruction
Top-down heapconstruction
39. DefineMax-heap.
Maxheap: A heap in which the parent has a larger key that the child’s key values then it
is called Maxheap.
PART-B
14
UNIT - IV
PART-A
1. Define Graph.
A Graph G, consists of a set of vertices V, and a set of edges E.V is a finite non-empty set
consisting of vertices of vertices of the graph. The set of edges E consists of a pair of vertices
from the vertex set.
6.Define a weightedgraph.
A graph is said to be weighted graph if every edge in the graph is assigned some weight or
value.The weight of an edge is a positive value that may be representing the distance between the
vertices or the weights of the edges along the path.
2
5 11
7. Define paralleledges.
In some directed as well as undirected graph certain pair of nodes are joined by more than one
edge, such edges are called parallel edges.
9.Define AdjacencyMatrix.
Adjacency Matrix is a representation used to represent a graph with zeros and ones.A graph
containing n vertices can be represented using n rows and n columns.
15
10. What is meant by Traversing aGraph?
It means visiting all the nodes in the graph
11. Define undirected graph / directedgraph.
If G=(V, E) is a graph. The edge between v1and v2is represented as (v1, v2). If the edges of the
form (v1, v2) and (v2, v1) are treated as the same edge, then G is said to be an undirected graph.
In case of a directed graph, the edge <v1, v2>and <v2, v1>are different.
A B C D
0 1 1 1
0 0 0 1
0 0 0 1
1 1 1 0
24. Prove that the maximum number of edges that a graph with n Verticesis 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 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.
PART-B
17
UNIT-V
PART-A
1. Define sorting
Sorting arranges the numerical and alphabetical data present in a list in a specific order
or sequence. There are a number of sorting techniques available. The algorithms canbe
chosen based on the followingfactors
– Size of the data structure
– Algorithmefficiency
– Programmer’s knowledge of thetechnique.
4. Define bubblesort
Bubble sort is a simple sorting algorithmthat works by repeatedly stepping through the
list to be sorted, comparing each pair of adjacent items and swappingthem if they are in
the wrong order. The pass through the list is repeated until no swaps are needed, which
indicates that the list is sorted. The algorithm gets its name from the way smaller
elements "bubble" to the top of the list.
9. Define radixsort
Radix Sort is a clever and intuitive little sorting algorithm. Radix sort is a non-
comparative integer sorting algorithmthat sorts data with integer keys by grouping keys
by the individual digits which share the same significant position and value.Radix Sort
puts the elements in order by comparing the digits of thenumbers.
23.Define Collision.
When two different keys compute in the same location or address in the hash table
through any one of the hashing function then it is termed as collision.
PART-B
21
1. Describe about selection sort with suitable example.
2. Examine the algorithm for Insertion sort and sort the following array: 77, 33,
44, 11, 88, 22, 66,55
3. List the different types of hashing techniques? Explain them in detail with
example.
4. Show the result of inserting the keys 2, 3, 5, 7, 11, 13, 15, 6, 4 into an initially
empty extendible hashing data structure with M =3.
5. Write a C program to search a number with the given set of numbers using
binarysearch.
6. Interpret an algorithm to sort a set of ‘N’ numbers using bubble sort
and demonstrate the sorting steps for the following set of numbers:
88,11,22,44,66,99,32,67,54,10.
7. Discuss the various open addressing techniques in hashing with anexample.
8. Sort the given integers and Show the intermediate resultsusing
shellsort:35,12,14,9,15,45,32,95,40,5.
9. Write an algorithm to sort an integer array using shellsort.
10. Illustrate with example the open addressing and chaining methods oftechniques
collision resolution techniques inhashing.
11. Compare working of binary search and linear search technique withexample.
12. Analyze extendible hashing inbrief.
13. Explain in detail about separatechaining.
14. Formulate the rehashing technique with suitableexample.
15. Prepare an algorithm to sortthe elements using radix sortexample.
16. Mention the different Sorting methods and Explain about method in detailed
Manner.
17. Sort the sequence 96, 31, 27,42,76,61,10,4 using shell sort and radix sort and
prepare the requiredsteps.
18. Given input {4371,1323,6173,4199,4344,9679,1989} and a hash function
h(x) =xmod10 Prepare the resulting for thefollowing:
a. Separate chaining hashtable.
b. Open addressing hash table using linearprobing.
c. Open addressing hah table using quadraticprobing.
d. Open addressing hash table with second hashh2(x)=7- (x mod7).
19. Write and explain non-recursive algorithm for binarysearch.
20. Using binary search, search the number 26 from the list of numbers and give the
steps.10,7,17,26,32,92
22