# Design and analysis of algorithm all previous/ past question papers

-Design and analysis of algorithm –Computer Science all subject past paper  Design and analysis of algorithm – Design and analysis of algorithm Project idea -Design and analysis of algorithm MCQ -Design and analysis of algorithm Interview Question  –Computer Science all courses -Technology –University Past Paper -Programming language –Question paperold paper

## Design and analysis of algorithm Mid Term Examination in 2021

Q1:

1. Which parameters are considered essential to analysis a good algorithm?
2. Explain Flow Chart with the help of diagram and example?

Q2:

Write down Bubble Sort Algorithm?

Q3:

Perform Insertion Sort on following Array will all steps.

 6 4 3 8 9 2 1

Q4:

Draw Flow Chart of following code.

int num;

cout<<”enter number”;

cin>>num;

if(num%2==0)

cout<<”even number”;

else

cout<<”odd number”;

return 0;

int marks;

cout<<”Enter Marks”;

cin>>marks;

if(marks<50)

cout<<”Fail”;

else if(marks>=50 && marks<60)

cout<<”3rd”;

else if(marks>=60 &&marks<75)

cout<<”2nd”;

else if(marks>=75 &&marks<100)

cout<<”1st”;

return 0;

Q5:

Calculate Time Complexity of the following code.

Int n,i;

cin>>n;

int a=0;

i=n;

while(i>=1)

{

a=a+1;

i=i/2;

}

## Design and analysis of algorithm paper II in 2020

Q1: Find the GCD of x, y and z (where x = 203, y = 91 and z = 77) using Euclids Algorithm.

Q2: How are the Upper, Lower and Tight Bounds on a given function f(x) and its growth function g(x) are represented mathematically and graphically? Describe the behavior of a function in the of Logarithmic, Linear, Quadratic, Cubic and Exponential expression.

Q3: Find Edit Distance of the following pair of string using Longest Common Subsequence (LCS) technique:

Str1 = india,        Str2 = Pakistan

Q4: Consider a farmer who wants to take some fruit and vegetables in his knapsack and he wants to get as much profit as possible. Following are the weights and values of the items ‘i’ in ‘wi’ and ‘vi’ respectively:

 Items (i) Weight (wi) – in kgs Value (vi) – in \$ Mangoes 2 6 Onion 4 4 Grapes 3 5 Oranges 5 9 Potatoes 6 5 Garlic 2 7

## Design and analysis of algorithm Sessional II in 2020

If total weight he can hold in his knapsack is 13 kg, which fruits and vegetables will be picked by the farmer? Also write down the algorithm for your approach with its analysis.

(Hint: Either he will take, or he will leave any particular item).

1. Which parameters are considered essential to analyze a good algorithm? 
2. Does input size matter? Suppose a program has run time O(n!) and the run time for

n = 10 is 1 second how much it will take for N=16  

1. Write down Algorithm Development Process steps in diagram format.
2. Running Time of an Algorithm depends on which parameter?
3. Find time complexity of the following code. 

int sum = 0, j;

for (j=0; j < N; j++)

for (j=0; j < 100; j++)

sum = sum +j;

1. Find time complexity for the following 

int j,k;

for (j=0; j<N; j++)

for (k=2; k<8; k++)

sum += k+j;

## Design and analysis of algorithm Final Paper in 2022

Q.NO.1

In Philippines, coins of 1, 5, 10, 25 centavos (officially called sentimo), IP, SP and 10P (officially called Peso) and currency notes of 20P, 50P, 100P, 500P, 1000P are used. How can we make the following denominations using Coin Change Problem with greedy approach? Also write an algorithm for coin change problem using dynamic programming with its complexity analysis. 

7.34 P

2891.45 P

390.21 P

74.58 P

0.99 P

-2: Apply Bellman-Ford Algorithm on the following graph. Show values after each iteration in a tabular form. S is the Starting node.

Q-5/Write down the algorithm for Huffman Encoding Technique with its complexity analysis. Consider your name and registration number as a string, apply Huffman Encoding Technique on this string (e.g. MUHAMMAD-ALI-MUSA-FA14-BCS-101).