Data Structures
Data Structures
Short Questions
Long Questions
Chetana Tailor
SRIMCA Page 1
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
Multiple Choice
Chetana Tailor
SRIMCA Page 2
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
Chetana Tailor
SRIMCA Page 3
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
a) Queue
b) Stack
c) Circular Queue
d) Array
18) Which of the following is not the operation on stack?
a) Push
b) Pop
c) Peep
d) Enqueue
19) In which of the data structure, space for the item is not claimed ,when an item is deleted
a) queue
b) circular queue
c) stack
d) linked list
20) As the items from a queue get deleted, the space for item is not reclaimed in queue. This
problem is solved by
a) circular queue
b) stack
c) linked list
d) doubly linked list
21) _______ no. of pointers are required to implement read and write operations in a queue
a) two
b) three
c) four
d) five
True/False
Chetana Tailor
SRIMCA Page 4
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
Short Questions
Chetana Tailor
SRIMCA Page 5
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
Long Questions
1) Write a short note on linked list including the storage structure, advantage, and disadvantage.
2) Write a pseudo code to add a node in the linked list at the end of the linked list.
3) Write a pseudo code to add a node at the front of the linked list.
4) Write a pseudo code to add a node at particular position in the linked list.
5) Write a pseudo code to add a node after particular node.
6) Write a pseudo code to delete a node in the linked list from the end of the linked list.
7) Write a pseudo code to delete a node from the front of the linked list.
8) Write a pseudo code to delete a node from particular position in the linked list.
9) Write a pseudo code to delete a node after particular node.
10) Write a pseudo code to traverse in the linked list.
11) Explain circular linked list.
12) Write a pseudo code to add node at the end in circular linked list.
13) Write a pseudo code to delete a node from the circular linked list.
14) Write a pseudo code to traverse in the circular linked list.
15) Explain doubly linked list including advantage and disadvantage of it.
16) Write a pseudo code to add node at the end in doubly linked list.
17) Write a pseudo code to delete a node from the doubly linked list.
18) Explain doubly circular linked list.
19) Write a short note on sparse matrix.
20) W rite a short note on polynomial manipulation w.r.t. single variable.
21) Write a short note on application of linked list.
22) Write a pseudo code for implementing stack using linked list.
23) Write a pseudo code for implementing queue using linked list.
Chetana Tailor
SRIMCA Page 6
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
Chetana Tailor
SRIMCA Page 7
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
d) Quick sort
10) Traversing in a singly linked list is
a) Only in one direction
b) In both direction
c) In any direction
d) None
11) The situation when in a linked list START=NULL is
a) Underflow
b) Overflow
c) Saturated
d) None
12) Which of the following is two way lists?
a) grounded header list
b) circular header list
c) linked list with header and trailer nodes
d) none of above
13) In a linked list, the pointer of the last node contains the special value called ______ linked.
a) null
b) linked to the first node
c) link
d) pointer to the tail node
14) We can combine the advantage of doubly linked list and circular linked list in ______.
a) Two way linked list
b) Two way circular linked list
c) One way linked list
d) Circular one way list
15) Which of the following is linear data structure:
a) Graph
b) Tree
c) Linked list
d) None
16) In which linked list, nodes forms a ring?
a) Circular
b) Doubly linked list
c) Singly linked list
d) All
17) If some of the data are frequently accessed then which one is better?
a) Array
b) Linked list
c) Graph
d) None
18) The concatenation of two lists is to be performed in O(1) time. Which of the following
implementations of a list could be used?
a) Singly linked list
Chetana Tailor
SRIMCA Page 8
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
True False
Chetana Tailor
SRIMCA Page 9
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
20) A Linked list is a data structure where elements can be added or removed at either end but not
in the middle.
Unit : Tree
Short Question
1) Define tree.
2) Explain following terms using appropriate example:
a. Parent
b. Child
c. Root
d. Leaf
e. Level
f. Height
g. Sibling
3) What do you mean by binary tree?
4) State difference between binary tree and binary search tree.
5) What is the difference between full binary tree & complete binary tree?
6) Draw a tree with the given string notation:
(A(B(C(E),F,D),G(H,(I(J)))))
7) Explain different techniques to represent tree.
8) Explain in brief the different operations you can performed on tree.
9) Explain tree traversing techniques.
10) What are the applications of the tree?
11) Write a code to traverse tree in preorder (recursive).
12) Write a code to traverse tree in inorder (recursive).
13) Write a code to traverse tree in postorder (recursive).
14) Explain briefly merge operation of the tree.
15) Pre order traversion is depth first search. Justify.
16) Explain Decision tree with appropriate example.
17) Briefly explain expression tree. Where the expression tree is generally used?
18) What do you mean by heap tree? What are the types of the heap tree?
19) List the benefits of the threaded binary tree over binary tree.
20) Define forest. Also give example of it.
Long Question
1) Explain binary tree with its representation including advantage & disadvantage.
2) Write a code to insert a node in a binary tree.
3) Write a code to delete a node from the binary tree.
4) Explain the merge of the tree with example as well as write a code for it.
5) Write a code to traverse a tree in preorder without recursion. Also trace the algorithm with
appropriate example.
6) Write a code to traverse a tree in inorder without recursion. Also trace the algorithm with
appropriate example.
Chetana Tailor
SRIMCA Page 10
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
7) Write a code to traverse a tree in postorder without recursion. Also trace the algorithm with
appropriate example.
8) How will you create a binary tree explain with appropriate example? Draw picture for insertion
of each node.
9) List at least 3 properties of binary tree. Prove any one property of the binary tree.
10) Prove that, in a binary tree, the maximum number of nodes on level l is 2l, where l>=0.
11) Prove that, the maximum number of nodes possible in a binary tree of height h is 2h-1.
12) Prove that, the minimum number of node in a binary tree of height h is h.
13) Prove that, for any non empty binary tree, if n is the number of nodes and e is the number of
edges, then n=e+1.
14) For any non empty binary tree T, if n0 is the number of leaf nodes (degree=0) and n2 is the
number of internal nodes(degree=2), then n0=n2+1
15) The height of a complete binary tree with n number of nodes is ⌈log2(n + 1)⌉.
16) Create a binary tree using inorder and preorder sequence:
Inorder : D B H E A I F J C G
Preorder: A B D E H C F I J G
17) Create a binary tree using inorder and postorder sequence:
Inorder : D B H E A I F J C G
Postorder: D H E B I J F G C A
18) Construct an expression tree: (A-B*C)-(D*E+F/G).
19) Create a binary tree from the following sequence:
35,45,20,16,42,29,24,33,27
Also delete a node having two children.
20) Explain heap tree and also the deletion of a node from a heap tree with appropriate example.
21) Write a code to create threaded binary tree.
22) Explain threaded binary tree and also write a code to traverse the threaded binary tree.
23) Write a short note on weighted binary tree.
24) Explain following terms with appropriate example:
a) Path length
b) External node
c) Internal node
d) External path length
e) Internal path length
f) Weighted path length
25) Write a short note on decision tree.
26) Explain Forest with traversion techniques.
Chetana Tailor
SRIMCA Page 11
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
Chetana Tailor
SRIMCA Page 12
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
a) 2
b) 4
c) 6
d) 8
e) 9
9.2 How many of the nodes have at least one sibling?
a) 5
b) 6
c) 7
d) 8
e) 9
9.3 What is the value stored in the parent node of the node containing 30?
a) 10
b) 11
c) 14
d) none
9.4 How many descendants does the root have?
a) 0
b) 2
c) 4
d) 8
9.5 What is the depth of the tree?
a) 2
b) 4
c) 8
d) None
9.6 How many children does the root have?
a) 6
b) 7
c) 8
d) 9
Chetana Tailor
SRIMCA Page 13
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
10) A binary tree of height which as all its permissible maximum number of nodes is known as
____________________.
11) A binary tree could be represented using a _______________data structure as well as
______________ data structure.
12) An important operation that is performed on a binary tree is known as ___________.
13) A traversal is governed by three action ____________, ______________ and ______________.
14) A traversal keep moving left in the binary tree until one can move, process the node and moves
to the right to continue is called as ___________ traversal.
15) Left, root, right traversal known as ___________ traversal.
16) Root, left, right traversal known as ___________ traversal.
17) Left, right, root traversal known as ___________ traversal.
18) In _______________ algorithm, the deletion procedure is complex.
19) ______________ is the process of visiting every node in a tree at least once.
20) In ____________traversal, the root node is visited last.
21) Children of the same parent are called ________________.
22) Nodes which are subtrees of another node are called ________________.
23) If a node is a terminal node, then its left child and right child field are filled with _____________.
True or False
Unit : Sorting
Short Question
Chetana Tailor
SRIMCA Page 14
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
Chetana Tailor
SRIMCA Page 15
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
Long Question
Unit: Searching
Short Question
1) A sorting technique that guarantees , that records with the same primary key occurs in the same
order in the sorted list as in the original unsorted list is said to be
a) stable
Chetana Tailor
SRIMCA Page 16
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
b) consistent
c) external
d) linear
2) What is the worst-case time for serial search finding a single item in an array?
e) Constant time
f) Logarithmic time
g) Linear time
h) Quadratic time
3) What is the worst-case time for binary search finding a single item in an array?
a) Constant time
b) Logarithmic time
c) Linear time
d) Quadratic time
4) Which of the following is not the required condition for binary search algorithm?
a) The list must be sorted
b) There should be the direct access to the middle element in any sub list
c) There must be mechanism to delete and/or insert elements in list
d) None of above
5) Which of the following is not a limitation of binary search algorithm?
a) Must use a sorted array
b) Requirement of sorted array is expensive when a lot of insertion and deletions are needed
c) There must be a mechanism to access middle element directly
d) Binary search algorithm is not efficient when the data elements are more than 1000.
6) Binary search algorithm cannot be applied to
a) sorted linked list
b) sorted binary trees
c) sorted linear array
d) pointer array
7) Which of the following case does not exist in complexity theory
a) Best case
b) Worst case
c) Average case
d) Null case
8) The Worst case occur in linear search algorithm when
a) Item is somewhere in the middle of array
b) Item is not in the array at all
c) Item is the last element in the array
d) Item is the last element in the array or is not there at all
9) The average case occur in linear search algorithm
a) When item is somewhere in the middle of the array
b) When item is not in the array at all
c) When item is the last element in the array
d) When item is the last element in the array or is not there at all
10) The complexity of the average case of an algorithm is
Chetana Tailor
SRIMCA Page 17
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
Chetana Tailor
SRIMCA Page 18
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
c) 11/7
d) 1/16
1) ________________search is one where a key K is searched for, in a linear list L of data elements.
2) Ordered linear search reports a time complexity of worst case is _________ and base case is
_________ in terms of key comparisons.
3) Unordered linear search reports a time complexity of worst case is _________ and base case is
_________ in terms of key comparisons.
4) The complexity of linear search algorithm is ________________.
5) ________________is an algorithm design technique where to solve a problem; the problem is
divided in to sub-problems.
6) In the case of binary search, the _____________________ aspect of the technique breaks the
list into two sub lists.
7) The complexity of binary search algorithm is ________________.
8) A sorting technique is said to be __________if keys that are equal retain their relative orders of
occurrence even after sorting.
9) If the lists of data to be sorted are small enough to be accommodated in the internal memory of
the computer, then it is known as ____________.
10) If the lists of data to be sorted are small enough to be accommodated in external storage device,
then it is known as ____________.
11) The complexity of Bubble sort algorithm is _______________.
12) The complexity of insertion sort algorithm is _______________.
13) The average case performance of insertion sort reports ________complexity.
14) __________and __________sort is not stable.
15) The complexity of selection sort algorithm is _______________.
16) ____________ is a process by which two ordered list of elements are combined into single
ordered list.
17) The complexity of merge sort algorithm is _______________.
18) ________________merge sort procedure is built on the design principle of divided and
conquers.
19) The two-way merge sort principle could be extended to k ordered lists in which case it is termed
as ___________ merging.
20) The complexity of quick sort algorithm is _______________.
True or False
1) The Sequential Search method on sorted lists is faster than the indexed method.
2) The search technique which loads only a part of the database into main memory is known as
external search.
3) A Binary Search can only be applied to sorted records.
4) In Binary Search, when the key is less than the middle element in a sorted array, the higher limit
is modified for the next iteration.
Chetana Tailor
SRIMCA Page 19
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
1) Explain linear search with respect to array and linked list. Also write algorithms for each.
2) Write an algorithm for binary search and also explain with it with example. What are the
necessary conditions for it?
3) Write a short note on binary tree searching.
4) Explain B tree with appropriate example.
5) Explain B+ tree with appropriate example.
6) What are the difference between linear search & binary search?
7) What are the merits and demerits of the binary search?
8) Explain in brief binary tree searching.
9) In linked list, which searching technique is better linear search or binary search?
10) Write a note on B tree.
11) Write a note on B+ tree.
12) What are the difference between B tree & B+ tree?
13) What are the differences between Binary Tree Search & B tree?
14) If one want to print all the key values of the Tree then which searching technique is useful?
Justify your answer.
Short Question
1) Define algorithm.
2) What are the two main criteria to measure the complexity?
3) What is an instance of the sorting problem?
Chetana Tailor
SRIMCA Page 20
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
Chetana Tailor
SRIMCA Page 21
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
Long Question
Chetana Tailor
SRIMCA Page 22
Department of Computer Science and Technology 2011
040020102 – Advance Data Structure and Analysis of Algorithm
c) Bubble sort
d) All of above
6) A list of n strings, each of length n, is sorted into lexicographic order using the merge-sort
algorithm. The worst case running time of this computation is:
a) O (n log n)
b) O (n2 log n)
c) O (n2 + log n)
d) O (n2)
7) Dynamic programming divides problems into a number of
a) conflicting objective functions.
b) decision stages.
c) unrelated constraints.
d) policies.
e) none of the above
8) The relationship between stages of a dynamic programming problem is called a(n)
a) state.
b) random variable.
c) node.
d) Transformation.
e) none of the above
9) Match the following
a) All pairs shortest path a) Greedy
b) Quick sort b) Depth first search
c) Minimum weight spanning tree c) Dynamic Programming
d) Connected Component d) Divide and conquer
Chetana Tailor
SRIMCA Page 23