0% found this document useful (0 votes)
11 views4 pages

DSA IMP Questions

The document contains a series of questions and tasks related to data structures, including linked lists, trees, graphs, and sorting algorithms. It covers concepts such as searching, merging, traversing, and constructing various data structures, as well as implementing algorithms in C. Additionally, it addresses topics like AVL trees, binary search trees, hash functions, and sorting techniques.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views4 pages

DSA IMP Questions

The document contains a series of questions and tasks related to data structures, including linked lists, trees, graphs, and sorting algorithms. It covers concepts such as searching, merging, traversing, and constructing various data structures, as well as implementing algorithms in C. Additionally, it addresses topics like AVL trees, binary search trees, hash functions, and sorting techniques.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Module-3

1. What is the running time to search an element in a linked list containing n number of nodes?
2. List the advantages of Linked stack over Linear stack.
3. Why is a single-linked list called a one-way list whereas a double-linked list is called a two-way list?
4. Represent the following polynomial using a linked list:
7x3−5x2+4x+10
5. Write a C function to delete the last node of a double-linked list.
6. Write a C function to traverse a double-linked list in both forward and backward directions.
7. Write a C function to merge two linked lists.
8. Write a C function to insert a new node at any location of a single linked list.

9. Write a C function to delete the last node of a single circular linked list.

10. Write a C function to search an element from a single linked list.

11. Write a menu driven program using C to perform the following operations on doubly linked list;

1. Create a list
2. Forward Traverse
Module-4

1. If a directed graph contains 8 vertices then what will be the dimension of its adjacency matrix?
2. What is rotation? What are the different types of rotation techniques used in balancing an AVL tree?
3. Find out whether the following statement is True or False.
The height of any node in a tree is always the same as the depth of that node.
4. Which traversal of any BST arranges the elements in increasing order?
5. Construct a binary tree whose pre-order and in-order traversal results are given below.
Pre-order: A B D E F C G H J L K
In-order: D B F E A G C L J H K
6. Construct a BST with the elements: 100 80 90 120 110 85 35 47 138 190 162 45 135.
After the construction of the BST, delete 120 from the constructed BST. Draw the final BST after the
deletion of 120.
7. Write the Breadth-First-Search (BFS) algorithm to traverse a graph. Find out the BFS traversal result
on the following graph considering node ' B' as the starting node.

8. Write the Depth-First-Search (DFS) algorithm to traverse a graph. Find out the DFS traversal result on
the following graph considering node 'B' as the starting node.

9. Construct an AVL tree with the following nodes:


jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec
10. Construct an AVL tree with the following elements:
55, 66, 77, 15, 11, 33, 22, 35, 25, 44, 88, 99
11. Construct a BST with the elements: 100 80 90 120 110 85 35 47 138 190 162 45 135.
After the construction of the BST, delete 120 from the constructed BST.
Draw the final BST after the deletion of 120 and then find out its pre-order, in-order, and post-order
traversal.
12. Construct a Binary Search Tree (BST) whose post-order traversal is given as follows:
Pre-order traversal: 78 70 94 96 90 135 175 150 100
13. Construct a Binary Search Tree (BST) whose pre-order traversal is given as follows:
Pre-order traversal: 100 90 70 78 96 94 150 135 175
14. Explain why a Binary Search Tree (BST) is called a Binary Sorted Tree.
15. What is rotation? What are the different types of rotation techniques used in balancing an AVL tree?
Explain each rotation with a suitable example.
16. Define a binary tree recursively.
17. Define a tree recursively.
18. What is a General Tree? How is it different from a Binary Tree?
19. What are the different techniques used to represent a binary tree in the computer memory? Explain
with a suitable example.
20. Find out the total number of leave and non-leave nodes of a complete binary tree of height 5.
21. Find out the total number of leave and non-leave nodes of a complete binary tree of height h.
22. What is the minimum and maximum number of nodes in an almost complete binary tree of height h?
23. Which traversal of any BST arranges the elements in increasing order?
24. Find out whether the following statement is true or false.
All AVL Trees are Binary Search trees.
25. Find out whether the following statement is true or false.
All Binary Search Trees are AVL trees.
26. Define an AVL tree.
27. State the relation between height and number of nodes in a binary tree. Show the maximum and
minimum value in each
Module-5
1. Write two major criteria to select a suitable hash function.
2. Which node contains the largest element in a max heap?
3. Fill in the blank with the most suitable option given below.
------------------------------ sorting technique is similar to the method used by the card players.
a) Bubble sort
b) Insertion sort
c) Selection sort
d) Quick sort
4. Give examples of two sorting algorithms that use the divide and conquer mechanism to sort the array
elements.
5. Give examples of 2 sorting algorithms that uses the divide and conquer mechanism to sort the array
elements.
6. Construct a max heap from the following set of elements:
A = (9, 6, 8, 7, 21, 14, 15, 19, 13, 12)
7. Illustrate the divide and conquer process of sorting the following elements using Merge Sort.
14, 7, 3, 12, 9, 11, 6, 12, 5, 4, 8
8. What is collision? What are the techniques available to resolve it? Explain each technique with a
suitable example. Explain the advantages and limitations of each technique.
9. What is the worst-case running time of quick sort? When the worst case will arise? Step by step
illustrate the operation of partition on the given array (up to the first partition) taking the last element
of the array as the pivot element.
A=< 13,19,9,5,12,8,17,4,21,2,6,11 >
10. Write the MAX-HEAPIFY algorithm or C function used in the Heap Sort algorithm. Illustrate the
operation of MAX-HEAPIFY ( A, i ) on the array A = { 32, 19, 18, 21, 17, 15, 16, 12, 20, 13, 14, 11 }.
11. Consider a hash table of size 10 initially which is empty. The hash function uses the division method
with remainder modulo 7, namely, H(k) = (k % 7) + 1. Construct the hash table with the following set
of key values: 20, 16, 10, 31, 14, 33, 27. Consider that the Linear Probing method is to be used if a
collision occurs during the insertion of any key into the hash table. Find out the total number of
collisions that occurred. Draw the final hash table.
12. Consider a hash table of size seven, with starting index zero, and a hash function (3x + 4) mod 7.
Assuming the hash table is initially empty, which of the following is the contents of the table when the
sequence 1, 3, 8, 10 is inserted into the table using closed hashing? Note that ‘_’ denotes an empty
location in the table.
A. 8, _, _, _, _, _, 10
B. 1, 8, 10, _, _, _, 3
C. 1, _, _, _, _, _,3
D. 1, 10, 8, _, _, _, 3

You might also like