0% found this document useful (0 votes)
12 views

ADSA Assi

Uploaded by

Sameer Najam
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)
12 views

ADSA Assi

Uploaded by

Sameer Najam
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/ 3

Advanced Data Structures and Algorithms

(Section-30)
Note: Handwritten assignment to be submitted.
Issued on: 26-Nov-2024
Deadline: 01-Dec-2024

1. Define algorithmic complexity and explain its significance. Compare time and space
complexity with examples.
2. Explain Big O, Omega, and Theta notations with examples.
3. Analyze the time complexity of the following pseudocode.

for (i = 1; i <= n; i++) {


for (j = 1; j <= i; j++) {
print("*");
}
}

4. Solve and analyze the time complexity of a binary search algorithm for an array of
size n=16n = 16n=16.

Arrays

1. Compare static and dynamic arrays in terms of memory management and


performance.
2. Write a program to find the maximum and minimum elements in an array and analyze
its time complexity.
3. Describe an efficient algorithm to reverse an array in place and explain its complexity.
4. Explain how to find the Kth smallest element in the array [7,10,4,3,20,15][7, 10, 4, 3,
20, 15][7,10,4,3,20,15] for K=3K = 3K=3. Discuss sorting and Quickselect methods.

Linked Lists

1. Describe the implementation of a singly linked list and write an algorithm for
insertion at the beginning.
2. Compare singly, doubly, and circular linked lists in terms of memory usage and
operations.
3. Write a program to delete a specific node from a circular linked list and analyze its
time complexity.
4. Explain the traversal operation in a doubly linked list and its applications.
5. Write a function to merge two sorted linked lists into a single sorted linked list.
6. Implement a program to remove duplicate nodes from an unsorted linked list.
7. Write a program to implement a queue using a singly linked list.
8. How would you implement a stack using a singly linked list? Write the code for push
and pop operations.
9. Explain and implement a function to check whether two singly linked lists intersect at
any point.

Stacks

1. Explain how a stack can be implemented using a linked list and write the algorithm
for the "push" operation.
2. Convert the infix expression (A+B)∗ (C−D)/(A+B) to postfix using a stack and write
the algorithm.
3. Evaluate the postfix expression 62/3+5∗ 8−6 /2 using a stack and explain the process
and write the algorithm.
4. Discuss the role of stacks in recursion and their use in function call management.

Recursion

1. Write a recursive function to calculate the power of a number Xn (where n>=0).


2. Write a recursive function to reverse a string.
3. Design a recursive algorithm to compute the greatest common divisor (GCD) of two
integers using the Euclidean algorithm.

1. Implement a recursive function to solve the N-Queens problem.


2. Write a recursive function to perform a depth-first search (DFS) traversal on a graph.
3. Given a sorted array, write a recursive binary search function to find the index of a
given element.
4. Explain the difference between tail recursion and non-tail recursion with examples.
Why is tail recursion preferred in some cases?
5. Solve the Tower of Hanoi problem for n=4n = 4n=4 disks and write the sequence of
moves.

Queues

1. What are the advantages of using a circular queue over a simple queue?
2. Explain the implementation of a queue using a linked list, including enqueue and
dequeue operations.
3. Discuss the concept of a priority queue and describe its implementation using a heap.
4. Write an algorithm to implement a circular queue and explain its advantages over a
regular queue.
5. Design a linked list-based implementation of a queue.
6. Write a function to reverse the elements of a queue using recursion.
7. Implement a circular queue and demonstrate enqueue and dequeue operations.
8. Write a program to simulate a printing queue where jobs are processed in the order
they are received.
9. Describe the concept of a double-ended queue (Deque). Give an example where a
deque can be useful.

Hashing

1. Explain the concept of hashing and collision resolution techniques, such as chaining
and linear probing, with examples.
2. Insert the keys [23,43,13,27][23, 43, 13, 27][23,43,13,27] into a hash table of size 10
using the hash function h(x)=x%10h(x) = x \% 10h(x)=x%10 and chaining.

Trees

1. Explain the linked list representation of a binary tree with an example.


2. Write an algorithm for in-order traversal of a binary tree and provide an example with
its traversal order.
3. Explain the operations of insertion and deletion in a binary search tree with examples.
4. Write an algorithm to search for a key in a binary search tree and analyze its time
complexity.
5. Insert the following elements into an initially empty binary search tree: 50, 30, 20, 40,
70, 60, 80. Draw the final structure of the binary search tree after all insertions.
6. Construct tree for following sequesnces
In-order traversal: 3, 5, 7, 10, 15, 20
Pre-order traversal: 10, 5, 3, 7, 15, 20
7. Given the Binary Search Tree:

Insert the value 60 and 75 into the tree and show the new tree structure.

8. Given the following Binary Search Tree, delete the node with value 30 and then 70:

You might also like