0% found this document useful (0 votes)
72 views8 pages

ADA Question Bank

Uploaded by

pvbagadia7700
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)
72 views8 pages

ADA Question Bank

Uploaded by

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

‭BHAGWAN MAHAVIR UNIVERSITY‬

‭FACULTY OF ENGINEERING‬

‭Computer Engineering Department‬

‭Analysis & Design of‬


‭Algorithms‬
‭(2010206503)‬
‭Question Bank‬

‭ ‬‭TH‬ ‭SEMESTER‬
5
‭WINTER-2024‬
‭Prof.- Manish Kumar Singh‬
‭Analysis & Design of Algorithms‬
‭Question Bank‬

‭ .‬
1 ‭ efine algorithm. Discuss key characteristics of algorithms.‬
D
‭2.‬ ‭What is asymptotic notation? Why is analysis of algorithms required?‬
‭3.‬ ‭Explain linear inequality and equations.‬
‭4.‬ ‭Explain why analysis of algorithms is important? Explain: Worst case, best case‬
‭and average case time complexity.‬
5‭ .‬ ‭Define: Space complexity & Time complexity‬
‭6.‬ ‭Define following terms with mathematical explanation:‬
‭(i) Big ‘Oh’ Notation (ii) Big ‘Omega’ Notation (iii) ‘Theta’ Notation‬
‭7.‬ ‭Write an iterative and recursive algorithm for finding the factorial of N. derive the‬
‭time complexity of both algorithms.‬
‭8.‬ ‭Solve the following recurrence relation using the iteration method.‬
‭𝑛‬ ‭2‬
‭T(n) = 8T(‬‭2‬ ‭) +‬‭𝑛‬ ‭. Here T(1) = 1.‬
9‭ .‬ ‭Find out big-oh notation of the f(n)= 3n 2 +5n+10‬
‭10.‬‭What is recurrence? Solve recurrence equation T (n) =T (n-1) + n using backward‬
‭substitution method.‬
‭11.‬‭Sort the given elements with Heap Sort Method: 20, 50, 30, 75, 90, 60, 25, 10, and‬
‭40.‬
‭12.‬‭Which are the basic steps of counting sort? Write a counting sort algorithm.‬
‭Derive its time complexity in the worst case.‬
‭13.‬‭Write down the Best case, Worst Case and Average case, Time-Complexity for the‬
‭following algorithms:‬
‭(i) Bubble sort, (ii) Selection sort, (iii) Insertion sort, (iv) Shell sort, (v) Heap sort,‬
‭(vi) Bucket sort, (vii) Radix sort, (viii) Counting sort.‬
‭𝑛‬ ‭2‬
‭14.‬‭Explain Asymptotic notation. Arrange the growth rate of‬‭2‬ ‭,‬‭𝑛‬ ‭, 1, log n, n logn,‬
‭3n‬‭and‬‭n‬‭in increasing order of growth.‬

‭15.‬‭How do divide and conquer approaches work? What do you mean by Divide &‬
‭Conquer approach? List advantages and disadvantages of it.‬
‭2‬
1‭ 6.‬‭Find out big-oh notation of the f(n) = 3‬‭𝑛‬ ‭+5n+10‬
‭17.‬‭State whether the statements are correct or incorrect with reasons.‬
‭1. O(f(n)) + O(f(n)) = O (2f(n))‬
‭2‬ ‭2‬
2‭ . If 3n + 5 = O(‬‭𝑛‬ ‭) , then 3n + 5 = o(‬‭𝑛‬ ‭)‬
‭18.‬‭Solve the following using Master’s theorem:‬
‭a. T(n) = 2T(n/4) + 1‬
‭b. T(n)=3T(n/4) + nlgn‬
‭2‬
‭19.‬‭Perform the analysis of a recurrence relation T(n)= 2T (n/2) + θ(‬‭𝑛‬ ‭) by drawing its‬
‭recurrence tree.‬
‭20.‬‭Explain how multiplication of large integers can be done efficiently by using‬
‭divide and conquer technique?‬
‭21.‬‭Demonstrate Binary Search method to search Key = 14, form the array‬
‭A= <2,4,7,8,10,13,14,60>.‬

‭Page‬‭1‬
‭Analysis & Design of Algorithms‬
‭Question Bank‬

2‭ 2.‬‭Multiply 981 by 1234 by divide and conquer method.‬


‭23.‬‭Trace given data using quick sort (3, 1, 4, 5, 9, 2, 6, 5).‬
‭24.‬‭Write a Merge sort algorithm and compute its worst case and best-case time‬
‭complexity. Sort the List G, U, J, A, R, A, T in alphabetical order using merge‬
‭sort.‬
‭25.‬‭Explain the use of Divide and Conquer Technique for Binary Search Method.‬
‭What is the complexity of the Binary Search Method? Explain it with an example.‬
‭26.‬‭Illustrate the working of the quick sort on input instances: 25, 29, 30, 35, 42, 47,‬
‭50, 52, and 60. Comment on the nature of input i.e. best case, average case or‬
‭worst case.‬
‭27.‬‭An array A[1…n] is‬‭Bitonic‬‭if there exists a‬‭t‬‭such‬‭that A[1…t] is increasing and‬
‭A[t+1…n] is decreasing. Give an efficient algorithm to sort a Bitonic array A.‬
‭28.‬‭What is the principle of optimality? Explain its use in the Dynamic Programming‬
‭Method.‬
‭29.‬‭What is Dynamic Programming and what are the common characteristics and‬
‭applications of it?‬
‭30.‬‭What are the differences between Divide-and-Conquer and Dynamic‬
‭Programming algorithms?‬
‭31.‬‭Explain Binomial Coefficient algorithm using dynamic programming.‬
‭32.‬‭What are the differences between Divide-and-Conquer and Dynamic‬
‭Programming algorithms?‬
‭33.‬‭Find the minimum number of multiplications required for multiplying: A[1 × 5],‬
‭B[5 ×4], C[4 × 3], D[3 × 2], and E[2 × 1].‬
‭2‬
‭34.‬‭Give an O(‬‭𝑛‬ ) ‭time algorithms to find the longest‬‭decreasing subsequence of a‬
‭sequence of n numbers.‬
‭35.‬‭Solve following knapsack problem using dynamic programming‬
‭36.‬‭algorithm with given capacity W=5, Weight and Value are as follows :‬
‭(2,12),(1,10),(3,20),(2,15)‬
‭37.‬‭Discuss Assembly Line Scheduling problem using dynamic programming with‬
‭examples.‬
‭38.‬‭Find optimal sequence of multiplication using dynamic programming of following‬
‭matrices: A1[10x100], A2[100x5], A3[5x50] and A4[50x1]. List optimal number‬
‭of multiplication and parenthesization of matrices.‬
‭39.‬‭Describe the longest common subsequence problem. Find longest common‬
‭subsequence of following two strings X and Y using dynamic programming.‬
‭X=abbacdcba,‬
‭Y=bcdbbcaac.‬
‭40.‬‭Solve Making Change Problem using Dynamic Programming. (Denominations:‬
‭d1=1, d2=4, d3=6). Give your answer for making change of Rs. 9.‬

‭Page‬‭2‬
‭Analysis & Design of Algorithms‬
‭Question Bank‬

‭41.‬‭Consider the following directed weighted graph-‬

‭ sing Floyd Warshall Algorithm, find‬


U
‭the shortest path distance between‬
‭every pair of vertices.‬

‭42.‬‭Write the characteristics of greedy algorithms. Mention any two examples of‬
‭greedy methods that we are using in real life.‬
‭43.‬‭Explain term –optimal substructure property.‬
‭44.‬‭Explain the difference between Greedy and Dynamic Algorithms.‬
‭45.‬‭What are the disadvantages of greedy methods over dynamic programming‬
‭methods?‬
‭46.‬‭Find an optimal Huffman code for the following set of frequency. a : 50, b: 20, c:‬
‭15, d:30.‬
‭47.‬‭"A greedy strategy will work for fractional Knapsack problem but not for‬
‭0/1", is this true or false? Explain.\‬
‭48.‬‭Write Kruskal's Algorithm to find out the Minimum Spanning Tree.‬

‭ pply the‬
A
‭same and find MST for‬
‭the graph given below.‬

‭49.‬‭Find Minimum Spanning Tree for the given graph using Prim’s Algo.‬

‭Page‬‭3‬
‭Analysis & Design of Algorithms‬
‭Question Bank‬

‭50.‬‭Run Dijkstra’s algorithm on the directed graph of Figure 4.3.1, first using vertex s‬
‭as the source and then using vertex z as the source.‬

‭Figure 4.3.1‬

5‭ 1.‬‭Find the Huffman code for each symbol in the following text.‬
‭52.‬‭ABCCDEBABFFBACBEBDFAAAABCDEEDCCBFEBFCAE.‬
‭53.‬‭Given 10 activities along with their start and finish time as‬
‭𝑆‬‭=<‬‭𝐴‬‭1,‬ ‭𝐴‬‭2‬‭,‬‭‬‭𝐴‬‭3‭,‬ ‬‭𝐴‬‭4‭,‬ ‭‬‬‭𝐴‬‭5‭,‬ ‬‭‬‭𝐴‬‭6‬‭,‬‭‬‭𝐴‬‭7‬‭,‭‬‬‭𝐴‬‭8‬‭,‭‬‬‭𝐴‬‭9‭,‬ ‬‭𝐴‬‭10‬‭>‬
‭𝑆‬‭𝑖‬‭=<1,2,3,4,5,6,7,8,9,10>‬
‭𝑓‬‭𝑖‬‭=<5,3,4,6,7,8,11,10,12,13>‬
‭54.‬‭Run the Bellman-Ford algorithm on the directed graph of Figure 4.3.2, using‬
‭vertex z as the source.‬

‭ igure 4.3.2‬
F
‭55.‬‭Solve the following Knapsack Problem using greedy methods. Number of items =‬
‭5,‬
‭56.‬‭knapsack capacity W = 100, weight vector = {50, 40, 30, 20, 10} and‬
‭profit vector = {1, 2, 3, 4, 5}.‬

5‭ 7.‬‭Explain: Articulation Point, Graph, Tree‬


‭58.‬‭Explain Minimax principle‬
‭59.‬‭Define: Dense graph, sparse graph. Describe strongly connected graphs with‬
‭examples.‬
‭60.‬‭Differentiate between BFS and DFS‬
‭61.‬‭Define graphs. Explain types of graph and different ways of graph representation‬
‭62.‬‭Define backtracking. State types of constraints used in backtracking.‬
‭63.‬‭Differentiate branch and bound and backtracking algorithm.‬

‭Page‬‭4‬
‭Analysis & Design of Algorithms‬
‭Question Bank‬

‭64.‬‭Explain the Minimax principle and show its working for simple tic-tac-toe game‬
‭playing.‬
‭65.‬‭Show how depth-first search works on the graph of the following figure.‬

‭66.‬‭Explain Backtracking Method. What is the N-Queens Problem? Give solution‬


‭of 4- Queens Problem using Backtracking Method.‬
‭67.‬‭Given is the DAG.‬

‭ pply the algorithm to perform‬


A
‭topological sort and show the sorted‬
‭graph.‬

‭68.‬‭A newspaper agent daily drops the newspaper to the area assigned in such a‬
‭manner that he has to cover all the houses in the respective area within minimum‬
‭travel cost.‬
‭Compute the‬
‭minimum travel‬
‭cost. The area‬
‭assigned to the‬
‭agent where he has‬
‭to drop the‬
‭newspaper is‬
‭shown in the given‬
‭figure.‬

‭Page‬‭5‬
‭Analysis & Design of Algorithms‬
‭Question Bank‬

‭69.‬‭Apply the algorithm to find strongly connected components from the‬


‭given graph.‬

‭70.‬‭Show the d and‬‭π‬‭values that result from running‬‭breadth-first search on the‬


‭directed graph of the following figure, using vertex 3 as the source.‬

‭71.‬‭Let n=4(‬‭𝑃‬‭1‭,‬ ‭‬‬‭𝑃‬‭2‬‭,‬‭‬‭𝑃‬‭3‬‭,‬‭‬‭𝑃‬‭4‭)‬ = (100,‬‭10, 15, 27) and (‬‭𝑑‬‭1‭,‬ ‬‭𝑑‬‭2‬‭,‬‭𝑑‬‭3‭,‬ ‬‭𝑑‬‭4‭)‬ = (2, 1, 2, 1)‬
‭where‬‭𝑃‬‭𝑖‬ ‭are profits on processes or job and‬‭𝑑‬‭𝑖‬ ‭are the deadline of‬
‭completion. Find the optimal schedule.‬

7‭ 2.‬‭Explain the classes of problems.‬


‭73.‬‭Define the Classes P, NP and NP-Completeness, and NP-Hard Problems.‬
‭Give examples of each.‬
‭74.‬‭What do you understand about NP-Completeness?‬
‭75.‬‭Explain “P = NP ?” problem.‬
‭76.‬‭Explain the 3SAT problem and show that it is NP Complete.‬
‭77.‬‭Explain traveling salesman problems. Prove that it is an NP complete‬
‭problem.‬
‭78.‬‭Show that if all the characters of pattern P of size m are different, the naïve‬
‭string-matching algorithm can perform better with modification. Write the‬
‭modified algorithm that performs better than O(n.m).‬
‭79.‬‭What is the string-matching problem? Define valid shift and invalid shift.‬
‭80.‬‭Write pseudo-code for Naïve-String-Matching algorithm.‬
‭Page‬‭6‬
‭Analysis & Design of Algorithms‬
‭Question Bank‬

‭81.‬‭What is Finite Automata? Explain use of finite automata for string matching‬
‭with suitable examples.‬
‭82.‬‭Write pseudo-code for Naïve-String-Matching algorithm.‬
‭83.‬‭Explain Naive string matching algorithm with example.‬
‭84.‬‭Show the comparisons that naïve string matcher makes for the pattern‬
‭p=0001 in the text T=000010001010001‬
‭85.‬‭Explain rabin-karp string matching algorithm.‬
‭86.‬‭Explain spurious hits in the Rabin-Karp string matching algorithm with‬
‭example. Working modulo q=13, how many spurious hits does the‬
‭Rabin-Karp matcher encounter in the text T = 2359023141526739921 when‬
‭looking for the pattern P= 26739?‬
‭87.‬‭Use an aggregate analysis to show that the running time of‬
‭KMP-MATCHER is Ө(n)‬

‭ .O.D
H Subject Teacher‬
‭ s. Rauki Yadav‬
M ‭Mr. Manish Singh‬

‭Page‬‭7‬

You might also like