0% found this document useful (0 votes)
63 views7 pages

Adsa Practice Questions

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)
63 views7 pages

Adsa Practice Questions

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/ 7

Advanced Data Structures and Algorithms

E2UC503C

Note: In case of programming problem, write your code in Java


or Python Only.

1 Write programs for Depth first search (DFS) and Breadth first
search (BFS). Find the complexity of algorithms. Apply DFS and
BFS on

2 What is a minimum spanning tree. Write a program for Prim’s and


Kruskal’s algorithms. Find the complexity of algorithms. Apply
Prim’s and Kruskal algorithms on (source is node 0)
3 What is single source shortest path problem. Write algorithms for
Dijkstra algorithm. Find its complexity, and apply on (source is
node 0)

4 What is all pairs shortest path problem. Write a algorithm for all pairs
shortest path. Find its complexity. Apply algorithm on

5 What are elements of Dynamic programming. How it is different


from Divide and conquer and greedy approach.
6 What are elements of greedy programming.
7 What is Longest Common Subsequence (LCS) problem. Write a
program to find a LCS. Find the complexity. Find LCS of str1 =
ABCDGH and str2 = AEDFHR.
8 What is the length of the LCS for the pair of subsequences given below. P =
ATGACTATAA , Q = GACTAATA

9 What is 0/1 Knapsack problem. Write a program for 0/1 Knapsack


problem and find is complexity. Apply 0/1 Knapsack algorithm on
Weights = {1, 2, 3} and Profit ={6,
10, 12} and we have knapsack of capacity 5.
10 What is fractional Knapsack problem. Write a program for
fractional Knapsack problem and find is complexity. Apply
fractional Knapsack problem on arr[] = {{100, 20}, {60,
10}, {120, 30}}, W = 50. Given the weights and profits of N
items, in the form of {profit, weight}, Knapsack capacity W.
11 What is N-Queens problem in algorithm. Write a program for N
Queens problem. Find the complexity.
12 Write a program for Counting Sort and Radix sort and find their
complexities.

13 What is a quad tree and Octrees, and what are their


applications?
14 What is an AVL trees? What is balancing factor in AVL tree.
15 What is tail recursion?
16 What is B+ tree? Explain its uses.
17 How to insert, delete, and search in a binary search tree(BST)
and their time complexities.
18 How a stack can be used to evaluate a mathematical
expression?
19 Write a recursive function to check weather a given string isa
palindrome.
20 What are the various collision resolution techniques in
hashing? Compare them.
21 Compare the advantages and disadvantages of recursive anditerative
approaches for solving a problem (take example of factorial of a
number).
22 Write a function to find the height of tree.
23 Write a program to implement a sparse matrix.
24 Write a program to parenthesis balancing?
25 Explain the concept of single-dimensional and multi-
dimensional arrays.
26 Describe how arrays are represented in the row major order.
27 Explain how arrays are represented in the column major order.
28 Define what a sparse matrix is and describe its
representation.
29 Explain how insertion and deletion operations work in a singly linked
list. Write its code also.
30 Derive the index formulae for 1-D, 2-D, and 3-D arrays.
31 Evaluate the time complexity of the insertion operation in a singly
linked list.
32 Given an array of size N with integers in the range of [1, N], the task
is to find the missing number from the first N integers. There are no
duplicates in the list. Write its program also.
33 Write a program that, given an array of n elements that contains
elements from 0 to n-1, with any of these numbers appearing any
number of times. Find these repeating numbers in O(n).
34 Describe the process of converting an infix expression to a postfix
expression. Write its program.
35 Define tail recursion and explain its significance.
36 Write a program to implement stack data structure using a linked
list.
37 Write a program to implement queue data structure using a linked
list.
38 Describe the steps involved in evaluating a postfix
expression.
39 Explain the principles of recursion and how it differs from
iteration.
40 How is a queue different from a stack, and in what scenarios is each
useful?
41 Analyse the advantages and disadvantages of using
recursion in problem-solving compared to iterative
approaches.
42 Implement a recursive function to solve the Tower of Hanoi
problem.
43 Create a program that demonstrates the use of a stack to check
the balance of parentheses in an expression.
44 Write a program to implement stack using queue and vice versa.
45 Explain the index sequential search and its principles.
46 Describe the basic concept of hashing in data structures.
47 List common collision resolution techniques used in hashing.
48 Compare and contrast sequential search and binary search
algorithms.
49 Write code to insert, delete, and search for a node in a binary
search tree.
50 Create a program that constructs a binary tree from given in-order
and pre-order traversals.
51 Implement a basic AVL tree and demonstrate insertion,
deletion, and searching operations.
52 Given the following input (4322, 1334, 1471, 9679, 1989,
6171, 6173, 4199) and the hash function x mod 10, find the
number of collisions.
53 Evaluate the efficiency of different types of search trees, such as
AVL trees, B+ trees, Quad trees, and Oct trees, for specific
applications.
Write a code to implement Quad tree, and oct tree.
How to solve question of the following type without creating a tree for
each given option.

56. Which of the following order of elements are inserted into an empty
AVL tree so that it is possible to get the above AVL tree.

94,71,86,25,98,83,27,90

B 98,94,90,83,86,25,71,27

C. 86,25,98,83,27,90,71,94

D. None of these

57. In what order we should insert the following elements into an empty
AVL tree so that we don’t have to perform any rotation on it.

1, 2, 3, 4, 5, 6, 7

A. 4, 2, 1, 6, 3, 5, 7

B. 4, 2, 6, 1, 3, 5, 7

C. 6, 4, 5, 7, 1, 2, 3
D. 4, 5, 3, 2, 1, 6, 7

58. The tree given is as follows:

30
/ \
12 45
\
18

Insert: 10,15,40,20,22
Which one of the following is the postorder traversal of the resultant
tree?
(A) 10,15,13,20,22,30,45,40,18
(B) 10,15,12,20,30,22,45,40,18
(C) 10,15,12,20,30,22,45,18,40
(D) None of these

59. Insert the given values in the order in initially empty AVL tree.

34,21,10,27,24,43,15,6

What is the value at the root of the tree

The tree given is as follows:

40
/ \
35 53
/ \
20 60

How many rotations are required for insertion of elements


30,55,45,65,42 in above tree.
(A) 2
(B) 3
(C) 4
(D) None of these
60. The pre-order traversal of a binary search tree is given by 12, 8, 6,
2, 7, 9, 10, 16, 15, 19, 17, 20. Then the post-order traversal of this tree
is:

(A) 2, 6, 7, 8, 9, 10, 12, 15, 16, 17, 19, 20

(B) 2, 7, 6, 10, 9, 8, 15, 17, 20, 19, 16, 12

(C) 7, 2, 6, 8, 9, 10, 20, 17, 19, 15, 16, 12

(D) 7, 6, 2, 10, 9, 8, 15, 16, 17, 20, 19, 12

You might also like