Time Left - 05:00 mins
NIELIT Scientist –B Quiz -2 (Algorithms)
Attempt now to get your rank among 613 students!
Question 1
How many comparisons are needed to sort an array of length 5 if a straight selection sort is used and array is already in the opposite order?
Question 2
Let P is a quick sort program to sort numbers in ascending order using the first element as the pivot. Let t1 and t2 be the number of comparisons made by P for the inputs [1 2 3 4 5] and [4 1 5 3 2] respectively. Which one of the following holds?
Question 3
Match the following groups.
Group-I (Method)
A- Divide and conquer.
B- Greedy.
C- Dynamic programming.
Group-II
1- Independent sub problems can be solved in any order to solve the given problem.
2- Always chooses the right subproblem to solve the given problem.
3- An optimal solution to a problem contain optimal solutions to subproblems.
4- Every optimal solution to a subproblem will contribute to the main problem solution.
Group-I (Method)
A- Divide and conquer.
B- Greedy.
C- Dynamic programming.
Group-II
1- Independent sub problems can be solved in any order to solve the given problem.
2- Always chooses the right subproblem to solve the given problem.
3- An optimal solution to a problem contain optimal solutions to subproblems.
4- Every optimal solution to a subproblem will contribute to the main problem solution.
Question 4
Give the correct matching for the following pairs when best cases are assumed for algorithms:
Question 5
Consider the following recurrence relation.
T(n) = T(n-1)+ 1/n if n>1
= 1 otherwise
What is the time complexity?
T(n) = T(n-1)+ 1/n if n>1
= 1 otherwise
What is the time complexity?
- 613 attempts
- 1 upvote
- 10 comments
Tags :
GATE & PSU CSAlgorithmsApr 6GATE & PSU CS