0% found this document useful (0 votes)
340 views2 pages

DAA Important Questions by Unit

The document contains important questions from 5 units: Unit 1 covers algorithms including definition, analysis, representation techniques, recursion, sorting algorithms like merge sort and quicksort. Unit 2 covers set representation using trees and algorithms for operations on sets like union and find. It also includes problems like n-queens and subset sum. Unit 3 is about dynamic programming and covers problems like traveling salesperson, all pairs shortest path, optimal binary search tree, knapsack. Unit 4 includes greedy algorithms, minimum spanning tree algorithms like Prim's and Kruskal's, and single source shortest path. Unit 5 is about NP-hard and NP-complete problems, the satisfiability problem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
340 views2 pages

DAA Important Questions by Unit

The document contains important questions from 5 units: Unit 1 covers algorithms including definition, analysis, representation techniques, recursion, sorting algorithms like merge sort and quicksort. Unit 2 covers set representation using trees and algorithms for operations on sets like union and find. It also includes problems like n-queens and subset sum. Unit 3 is about dynamic programming and covers problems like traveling salesperson, all pairs shortest path, optimal binary search tree, knapsack. Unit 4 includes greedy algorithms, minimum spanning tree algorithms like Prim's and Kruskal's, and single source shortest path. Unit 5 is about NP-hard and NP-complete problems, the satisfiability problem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
  • UNIT-I
  • UNIT-II
  • UNIT-III
  • UNIT-V
  • UNIT-IV

DAA Unit wise important 

question

 UNIT-I

1.         (a)        Define an algorithm. What are the different criteria that satisfy the algorithm?
(b)   Explain how algorithms performance is analyzed ? Describe asymptotic notation?
2.           What are the different techniques to represent an algorithm? Explain.
3.           Write an algorithm to find the sum of individual digits of a given number.
4.        What is meant by recursion? Explain with example, the direct and indirect recursive
algorithms.
5.          Write an algorithm for Fibonacci series and discuss time complexity.
6.       What is meant by time complexity? Define different time complexity notations? Define
example for one of each?

7.  Write the algorithm for binaryseach.


 8.       Draw the tree of calls of merge sort for the following [Link] algorithm.
     (35, 25,15,10,45, 75, 85, 65, 55, 5, 20, 18)
 9.       Sort the given set of elements using Quicksort
     (20, 30, 10, 40, 5, 60, 90, 45, 35, 25, 15, 55)
 10.       Write an algorithm for quick sort by using recursive method. complexity for Quick Sort

11. Explain Strassen is matrix multiplication algorithm with an example.     

UNIT-II

1.         (a)        Explain the set representation using trees.


(b)        Develop the algorithms for the following
i). UNION
ii) FIND
iii) WEIGHTED UNION.
iv)COLLAPSE FIND
 2.         n-queens problem with example algorithm

3. Sum of subsets problem with state space tree and algorithm.


4. Graph coloring state space tree and algorithm.

UNIT-III
1. Solve the tavelling sales person problem using dynamic programming with example.
2. With the help of suitable example Explain all pair shortest path problem.
3. Draw an Optimal Binary Search Tree for n=4 identifiers (a1,a2,a3,a4) = ( do, if, read, while)
P(1:4)=(3,3,1,1) and Q(0:4)=(2,3,1,1,1).
4. Write about 0/1 knapsack problem with example and algorithm
5. How the reliability of a system is determined using dynamic programming? Explain with
example.

UNIT-IV

1.    What is greedy method? Give the control abstraction for greedy method.

2.     What is the solution generated by the function JS when n = 7,


P [1 : 7 ] =(3,5,20,18,1,6,30) and W [1:7 ] = (1,3,4,3,2,1,2)  .write the algorithm
  
3.  Explain, how to find the minimum cost spanning tree by using Prim’s
     And Kruskal’s Algorithm.
[Link] knapsack problem with example.
[Link] about single source shortest path problem.

UNIT-V

1.                  (a) Write short notes on


i) Classes of NP-hard
ii) Classes of NP-complete
(b) Prove that if NP ≠ CO − NP, then P ≠ NP
   
2.       Distinguish between deterministic and non-deterministic algorithms
      3.        Explain the satisfiability problem?
[Link] the Travelling Salesman problem using branch and bound algorithms.
[Link] are the differences between backtracking and branch and bound solutions?
6. Explain the LC branch and bound algorithm.
[Link] how branch and bound technique is used to solve 0/1 knapsack problem.
8. Cook’s theorm

Common questions

Powered by AI

The greedy method and dynamic programming both solve optimization problems but differ in approach. Greedy algorithms make a series of locally optimal choices with the aim of finding a global optimum, sometimes failing for complex problems since they do not consider future consequences. Dynamic programming, on the other hand, breaks problems into subproblems, solves each subproblem once, and stores solutions to avoid recomputation, suitable for problems exhibiting optimal substructure and overlapping subproblems. Greedy algorithms are preferable when problems can be divided into stages with a guaranteed optimal local choice, such as in finding a minimum spanning tree. Dynamic programming is more appropriate when such guarantees cannot be made or need comprehensive exploration, like in the 0/1 knapsack problem .

The branch and bound technique solves the traveling salesman problem by exploring decision tree branches and eliminating paths more expensive than the current best. It begins with the full list of cities, branching by selecting each city for the current route, and calculating a lower bound cost for each partial route. If a partial route's cost exceeds the best known route, it's discarded. This approach prunes the search tree, reducing computational costs. As an example, suppose the cost for the first few visits in a tour exceeds a known complete tour cost; the algorithm backtracks early to explore alternate routes, optimizing through bounding and traversing in a systematic way .

Strassen's algorithm is a recursive divide-and-conquer algorithm for matrix multiplication, which reduces the number of multiplications needed from the conventional O(n^3) to approximately O(n^2.81). This improvement is achieved by breaking down each matrix into smaller sub-matrices and performing multiplications using only 7 instead of 8 recursive matrix multiplications and additional addition operations. Its significance lies in its improved efficiency for large matrices despite increased complexity in implementation. For example, multiplying two 2x2 matrices using Strassen's algorithm requires fewer arithmetic operations, demonstrating the reduction in computational overhead .

Asymptotic notation provides a framework for assessing algorithm performance in terms of time and space complexities. It allows us to describe the limiting behavior of an algorithm's resource usage as the input size grows. The primary forms of asymptotic notation include Big O (O), which describes the upper bound, Theta (Θ) for tight bounds, and Omega (Ω) for the lower bound. Understanding these notations is critical for comparing the efficiency of different algorithms across varied input sizes, allowing for informed decision-making in algorithm design .

A procedure must meet certain criteria to be considered an algorithm: definiteness (each step must be clear and unambiguous), finiteness (it must terminate after a finite number of steps), input (zero or more inputs are supplied), output (one or more outputs are produced), and effectiveness (all operations must be sufficiently basic). These criteria ensure that an algorithm is well-defined and can be implemented effectively to solve computational problems. Defining the criteria helps in standardizing the design process, ensuring that the result is computationally feasible and reliable .

The LC (Least Cost) branch and bound algorithm advances combinatorial problem-solving by selecting nodes with the least estimated cost to explore further, ensuring more promising paths are prioritised over less promising ones. This results in faster convergence to an optimal solution as the search is guided by cost-conscious path selection rather than unoptimized exploration. In contrast, basic branch and bound might explore nodes systematically without cost guidance, potentially examining numerous less-effective paths. LC improves efficiency in situations like identifying the shortest path or solving optimizations like the traveling salesman problem, where cost-effectiveness is crucial .

Deterministic algorithms operate with a predictable set of instructions leading to a single outcome for each input, suitable for problems where precise solutions are necessary—such as within database transactions. Non-deterministic algorithms explore multiple possibilities simultaneously, typical in simulation or exploratory scenarios, such as genetic algorithms or automated reasoning. These algorithms are theoretical constructs more than practical implementations, expressing parallel computation capabilities often used in decision problems where exhaustive search is practical, such as the satisfiability problem. Practical non-determinism is often implemented through randomization or parallelization techniques .

Direct recursion occurs when a function calls itself directly. For example, the classical Fibonacci sequence where a function calls itself to calculate the subsequent number in the sequence. Indirect recursion involves a sequence of function calls where eventually, the original function is called. An example is functions A() and B() where A() calls B() and B() calls A(). Both forms allow problems to be broken down into simpler sub-problems and can be used to solve problems that are naturally recursive, such as those involving hierarchical data structures .

The time complexity of Merge Sort is O(n log n) because it recursively divides the input list in half and then merges the sorted halves. The recursive tree structure helps illustrate this process: each level of the tree represents a division, and the number of levels is logarithmic relative to the input size. Each level requires O(n) operations to merge the lists back together. This efficient division and merging process make Merge Sort particularly suitable for large lists, offering better performance than simpler algorithms like insertion or bubble sort for large datasets .

The assumption P ≠ NP implies that not all problems verifiable in polynomial time can be solved in polynomial time, affecting computational theory significantly. It suggests a barrier between problems easily checkable (NP) and those solvable (P), influencing how algorithms are developed as problems classified as NP-complete cannot have efficient polynomial-time solutions assuming P ≠ NP. This leads to reliance on heuristic or approximation algorithms for NP-complete problems, guiding research towards identifying more tractable subproblems or special cases where polynomial-time solutions may exist. The assumption continues to prompt exploration in computational limits and algorithmic innovation .

You might also like