My Report

Data Structure II Practice Test 4


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. What is the total running time of the binary GCD algorithm?

2. Given the program of naïve method.

for i=1 to n do
   for j=1 to n do
       Z[i][j]=0;
       for k=1 to n do 
            ___________________________

Fill in the blanks with appropriate formula

3. What will be the output of the following code?

#include<iostream>
using namespace std;
int list[200];
void func(int n, int m = 0)
{
    int i;
    if(n == 0)
    {
         for(i = 0; i < m; ++i)
         printf("%d ", list[i]);
         printf("\n");
         return;
    }
    for(i = n; i > 0; --i)
    {
         if(m == 0 || i <= list[m - 1])
         {
             list[m] = i;
             func(n - i, m + 1);
         }
    }

}
int main()
{
	int n=3;
	func(n,0);
	return 0;
}

4. What is the correct formula for generating random numbers in the range (lower,upper) using rand()?

5. What is the running time of Chan’s algorithm?

6. Which of the following represent the correct pseudo code for non recursive DFS algorithm?

7. How many approaches can be applied to solve quick hull problem?

8. What is the recurrence relation used in Strassen’s algorithm?

9. Strassen’s algorithm is quite numerically stable as the naïve method.

10. Who invented the concept of inclusion-exclusion principle?


 

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.