Professional Documents
Culture Documents
Data Structures Worksheet
Data Structures Worksheet
10 Worksheets
5.10 Worksheets
Worksheet 1
198
5.10 Worksheets
Subjective Questions
1. Define data structure and various types of data structures.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
2. What are the various types of searching used in Data Structures? Explain with one example?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
3. What is algorithm and complexity? What are the types of algorithm analysis?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
199
5.10 Worksheets
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
4. Explain about Linked List Data Structure. What is doubly linked list?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
5. What are the advantages of Binary search over linear search?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
6. What is a difference between graph and tree?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
200
5.10 Worksheets
Worksheet 2
B. O(2n)
C. O(n2 )
D. O(n)
7: New nodes are added to the ........... of the queue.
A. Front
B. Back
C. Middle
D. Both A and B
8: The term push and pop is related to
A. Array
B. Lists
201
5.10 Worksheets
C. Stacks
D. Trees
9: Which of the following is an application of stack?
A. finding factorial
B. tower of Hanoi
C. infix to postfix
D. all of the above
10: The situation when in a linked list START=NULL is .........
A. Underflow
B. Overflow
C. Houseful
D. Saturated
Subjective Questions
1. What are the types of queues in Data Structures?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
2. Explain quick sort with an example.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
3. What do you understand by Tower of Hanoi? Explain with one example.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
202
5.10 Worksheets
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
4. What is the difference between PUSH and POP with example.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
5. In which condition linked list is better than array and vice versa?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
6. How can AVL Tree be useful in all the operations as compared to Binary search tree.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
203
5.10 Worksheets
Worksheet 3
205
5.10 Worksheets
B. O(log2 n)
C. O(n)
D. O(n log2 n)
10: Traversing a binary tree first root and then left and right subtrees called ......... traversal.
A. Postorder
B. Preorder
C. Inorder
D. None of these
Subjective Questions
1. What is the prefix and post fix notation of (a + b) * (c + d) ?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
2. How insertion sort and selection sorts are different?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
3. Explain the types of algorithm with examples.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
206
5.10 Worksheets
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
4. Explain the rate of growth. Which is commonly used with the help of table?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
5. Which data structure is used to perform recursion?.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
6. What is merge sort and how it works?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
207
5.10 Worksheets
Worksheet 4
208
5.10 Worksheets
A. Insertion sort
B. Merge sort
C. Quick sort
D. Bubble sort
10: A search begins the search with the element that is located in the middle of the array
A. serial
B. random
C. parallel
D. binary
Subjective Questions
1. What is hashing? Explain different hashing techniques in detail.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
2. What is a postfix expression?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
3. What is Graph? What are the types of graph?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
209
5.10 Worksheets
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
4. Which data structures are used in BFS and DFS algorithm?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
5. Explain the terms: null tree, left and right successor, terminal nodes, similar and copy tree.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
6. What are the differences between BST and AVL tree?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
210
5.10 Worksheets
Worksheet 5
211
5.10 Worksheets
D. 1
7: Following are pass outputs of a program for an algorithm: 22, 14, 56, 7, 25, 8
Pass 1: 7, 14, 56, 22, 25, 8
Pass 2: 7, 8, 56, 22, 25, 14
And so on...
Final: 7, 8, 14, 22, 25, 56
Choose the name of the associated algorithm for the above results.
A. Selection sort
B. Insertion sort
C. Bubble Sort
D. Merge Sort
8: Following are the pass outputs of a program for an algorithm: 22, 14, 56, 7, 25, 8
Pass 1: 14, 22, 56, 7, 25, 8
Pass 2: 14, 22, 56, 7, 25, 8
Pass 3: 7, 14, 22, 56, 25, 8
And so on...
Final: 7, 8, 14, 22, 25, 56
Choose the name of the associated algorithm for the above results.
A. Selection sort
B. Insertion sort
C. Bubble Sort
D. Merge Sort
9: Following are the pass outputs of a program for an algorithm: 22, 14, 56, 7, 25, 8
Pass 1: 14, 22, 7, 25, 8, 56
Pass 2: 14, 7, 22, 8, 25, 56
And so on...
Final: 7, 8, 14, 22, 25, 56
Choose the name of the associated algorithm for the above results.
(A) Selection sort
(B) Insertion sort
(C) Bubble Sort
(D) Merge Sort
10: Array representation of Binary tree
0 1 2 3 4 5 6
A.
7 11 2 7 1 11 9
212
5.10 Worksheets
0 1 2 3 4 5 6
B.
7 11 7 1 2 11 9
0 1 2 3 4 5 6
C.
7 1 11 11 9 2 7
D. Any of the above
Subjective Questions
1. Define the properties of recursion. Explain factorial.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
2. Explain the all-possible complexities (best, worst and average case) in a table.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
3. What are records? Explain record structure with one example.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
213
5.10 Worksheets
....................................................................................................
4. Create a BST tree with the following data by inserting the elements in order of their occurrence: 200, 150, 350,
100, 70, 110, 250, 500, 400, 550, 450
Delete the following nodes in sequential order: 150, 500, 450, 200, 110
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
5. Consider the graph given below. Find out its Breadth-First Traversal and show each steps.
214