0% found this document useful (0 votes)
28 views3 pages

ME Exam: Advanced Data Structures

The document outlines the examination structure for the Advanced Data Structures and Algorithms course, including parts A and B with specific questions on algorithm analysis, data structures, and complexity. It covers topics such as time and space complexity, B Trees, graph traversal, dynamic programming, and NP-Completeness. The exam consists of multiple-choice and detailed problem-solving questions aimed at assessing students' understanding of advanced data structures and algorithms.

Uploaded by

sobipunitha
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)
28 views3 pages

ME Exam: Advanced Data Structures

The document outlines the examination structure for the Advanced Data Structures and Algorithms course, including parts A and B with specific questions on algorithm analysis, data structures, and complexity. It covers topics such as time and space complexity, B Trees, graph traversal, dynamic programming, and NP-Completeness. The exam consists of multiple-choice and detailed problem-solving questions aimed at assessing students' understanding of advanced data structures and algorithms.

Uploaded by

sobipunitha
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

ME Degree Examinations Jan/Feb - 2025

24PCS101 - ADVANCED DATA STRUCTURES AND ALGORITHMS


First Semester

Duration : 3 Hour Max Marks: 100

Part A
Answer All Questions
10X2-20

1. Analyze the timeand space complexity of the below code:


Function AlgorithmA(Array A):
n=Length(A)
For from 0 to n-1:
i

j
For from 0 to n-1:

Perforn Operation

2. Prove that if fn)-O(gn) and g(n)=o(f(n) then fn) =0(gn).


3. ldentify the usage of B Tree in Database Indexingand access.

4. For the set of keys {1,4,5, 10,16,17,21}Construct a binary search tree of height 3.

5. Compare Breadth First Search with Depth First Search.

6. Interpret the working principle of Floyd - Warshall


Algorithm.

7. Outline the sequence of steps to be followed in developing a dynamic programming algorithm.

8. Give an example of a problem that can be solved using a greedy algorithm.

9. Why is the satisfiability problem (SAT) important in NP-Completeness?

10. StateCook's theorem.

Part B
Answer AllQuestions
5X13=65

11. ai) Howefficiency ofan algorithm is measured? Describe in detail about Asymptotic notations with

examples.(7 Marks)

i)For T(n)=7T(n/2) +1 [Link] the recurrencerelation using Substitution method.(6 Marks)


OR
b. Differentiate best, worst and average case analysis with examples & diagrams. Also, Explain how it
can be performed forLinear Searching in an array.
12. a)ldentify the advantage of Red Black Tree over Binary Search Trees. Construct Red Black tree for th a
following sct of clements 10,12,1,14,6,5,8,1 5,3, 1,13 and 2. 16,

1
OR
byConstruct a B tree of order 5 by inserting the following clements:

3,t4,7,1,8S.H7,
B.6,23,12,20,26,446,18,24,25 and 19.

13. ayllustrate the working of Breadth - First and Depth - First traversal on a Graph with pseudocode and

example.

OR
byi. Write the all pair shortest path algorithm.(5 Marks)

[Link] the below graph using the all pairs shortest path algorithm.(8 Marks)

4
3
2

5
9

qoenPeAore
14. á) Explain the algorithm to solve Matrix Chain Multiplication using Dynamic Programining with
efficiency.

OR
b) A character coding problem. A data file of 100,000 characters contains only the characters a-f, with
the frequencies indicated as below:

d e f

Frequency(in thousands) 45 13 12 16 9 5
Show the steps in constructing the Huffman Tree representing the optimal prefix code.

15. ay Elaboratethe following


()NP Completeness Problem

(ii) Reducibility

OR
b) Prove that if any NP-Compiete problen is poiynomiai-time solvable then [Link],if any
problem in NP is not polynomial-time solvable, then no NP-complete problem is polynomial-time
solvable.
Parte
Amwer Al Oueatna

nA (lHHnnt the mmnnm qanng tee uing ink and KnkakAlehe SoreNoe A Ala
ind the w of the ree

hAplysuitable atyorthn to tind shortest path hom 'A' o every other node of Aforthe figure given

below

Also, write tlhe steps tor (ndig the slotext path

Common questions

Powered by AI

Reducibility in NP-completeness refers to the ability to transform one problem into another in polynomial time. If one knows that a particular problem is NP-complete, demonstrating that another problem can be reduced to it in polynomial time is a common strategy to prove the second problem is also NP-complete. This concept is crucial for understanding how different computational problems relate to each other .

In the worst case, Merge Sort operates with a time complexity of O(n log n) due to the divide-and-conquer strategy that involves splitting the array and merging sorted halves. Insertion Sort, however, has a worst-case time complexity of O(n^2) because it may require comparisons and shifts for each element relative to the sorted portion of the array. Merge Sort is more efficient for larger datasets, while Insertion Sort can be advantageous with small or nearly sorted data due to its lower overhead .

To develop a dynamic programming algorithm, the steps include: 1) Define the structure of an optimal solution, 2) Recursively define the value of an optimal solution, 3) Compute the value of an optimal solution using a bottom-up approach, and 4) Construct an optimal solution from computed information .

Cook's Theorem establishes that the Boolean satisfiability problem (SAT) is NP-complete, meaning that if SAT can be solved in polynomial time, every problem in NP can also be solved in polynomial time. This theorem formed the basis for the concept of NP-completeness, by showing that SAT can serve as a benchmark for resolving the complexity of other problems .

Red-Black Trees offer balanced searching, insertion, and deletion operations, which guarantee O(log n) time complexity. They maintain balance through specific properties like node coloring and rotation, reducing the worst-case scenarios for heavily unbalanced trees often encountered in standard Binary Search Trees .

Huffman coding is an optimal prefix compression algorithm that assigns variable-length codes to input characters, with shorter codes assigned to more frequently-occurring characters. This minimizes the average number of bits per encoded character, achieving efficient compression. It is primarily used in applications requiring data compression, such as in ZIP files and JPEG images .

SAT is significant because it was the first problem proven to be NP-complete, which was established by Cook's Theorem. This means any problem in NP can be reduced to SAT in polynomial time, establishing SAT as a key problem in demonstrating the complexity of problems in NP-completeness .

An example of a problem solvable by a greedy algorithm is the coin change problem, where the goal is to make a certain amount of money with the fewest number of coins possible, assuming each coin has a predefined value. The greedy approach works if the coin denominations are such that choosing the largest possible denomination at each step leads to the optimal solution, which is not guaranteed for all sets of coin denominations .

The given algorithm has time complexity O(n^2) because it contains a nested loop that iterates over all pairs of elements in an array of size n. For each iteration of the outer loop, the inner loop also runs n times, resulting in a total of n*n = n^2 operations. The space complexity is O(1) since only a constant amount of extra space is used regardless of the input size.

BFS explores all neighbor nodes at the present depth prior to moving on to nodes at the next depth level, typically using a queue. It is suitable for finding the shortest path in unweighted graphs. DFS, on the other hand, explores as far down a branch as possible before backtracking, and uses a stack or recursive approach. It is better for exploring all paths in a search tree. BFS typically requires more memory than DFS due to its need to store all sibling nodes.

You might also like