Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Notes  >  Algorithms  >  Previous Year Questions: Divide and Conquer

Previous Year Questions: Divide and Conquer | Algorithms - Computer Science Engineering (CSE) PDF Download

Q1: Consider a sequence of 14 elements: A = [-5, -10, 6, 3, -1, -2, 13, 4, -9, -1, 4, 12, -3, 0]. The subsequence sum S(i, j) =Previous Year Questions: Divide and Conquer | Algorithms - Computer Science Engineering (CSE) A[k].
Determine the maximum of S(i, j), where 0 ≤ i ≤ j < 14. (Divide and conquer approach may be used). Answer:________  (2019)
(a) 25
(B) 12
(C) 29
(d) 17
Ans: 
(c)
Sol: 
Subsequence: A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.
Subarray: A subarray of n-element array is an array composed from a contiguous block of the original array's elements.
Question is asking for subsequence.
Previous Year Questions: Divide and Conquer | Algorithms - Computer Science Engineering (CSE)
What does    mean? It means you start from index i and go till index j with unit increment each time.
Ultimately they are asking 'Maximum subarray sum'.
Previous Year Questions: Divide and Conquer | Algorithms - Computer Science Engineering (CSE)
sum = 6 + 3 - 1 - 2 + 13 + 4 - 9 - 1 + 4 + 12 = 29

Q2: Given below are some algorithms, and some algorithm design paradigms.
Previous Year Questions: Divide and Conquer | Algorithms - Computer Science Engineering (CSE)
Match the above algorithms on the left to the corresponding design paradigm they follow.  (2015 SET-2)
(a) 1-i, 2-iii, 3-i, 4-v
(b) 1-iii, 2-iii, 3-1, 4-v
(c) 1-iii, 2-ii, 3-1, 4-iv
(d) 1-iii, 2-ii, 3-i, 4-v
Ans:
(c)
Sol: 
Dijkstra's Shortest path algorithm uses greedy design (always choosing the shortest neighbour) while Floyd Warshall Algorithm to compute all shortest paths uses Dynamic Programming.
Binary search uses Divide and Conquer (though we eliminate one part at each time) and Back tracking traversal to a graph uses Depth First Search (DFS) (in DFS we have to backtrack to a node after searching through all its descendant nodes if the searched node is not found).

Q3: Match the following:   (2015 SET-1)
Previous Year Questions: Divide and Conquer | Algorithms - Computer Science Engineering (CSE)
(a) P-iii, Q-ii, R-iv, S-i
(b) P-i, Q-ii, R-iv, S-iii
(c) P-ii, Q-iii, R-iv, S-i
(d) P-ii, Q-i, R-iii, S-iv
Ans: 
(c)
Sol: 

Prim's algo. always chooses minimum adj. edge using greedy technique.
Floyd is a dynamic programming technique.
Merge is a divide & conquer as we first divide the given array till single element and then merge them in single sorted array.
Hamiltonian uses back tracking.
P-2
Q-3
R-4
S-1

Q4: The minimum number of comparisons required to find the minimum and the maximum of 100 numbers is _________________.  (2014 SET-1)
(a) 100
(b) 99
(c) 198
(d) 148
Ans: 
(d)
Sol: 
We can solve this question by using Tournament Method Technique -
1. To find the smallest element in the array will take n - 1 comparisons = 99.
2. To find the largest element -
a. After the first round of Tournament, there will be exactly n/2 numbers = 50 that will loose the round.
b. So, the biggest looser (the largest number) should be among these 50 loosers.
To find the largest number will take n/2 - 1 comparisons = 49.
Total 99 + 49 = 148.

Q5: If n is a power of 2, then the minimum number of multiplications needed to compute an is  (1999)
(a) log2 n
(b) √n
(c) n-1
(d) n
Ans: 
(a)
Sol: 
an = (a2)n/2.
One multiplication and recurrence on n/2. So, we get the recurrence relation for the number of multiplications as
T(n) = T(n/2) + 1.
This gives T(n) = log2n.
For n = 8, we can do
b = a x a
b = b x b
b = b x b and we get b = a8.

The document Previous Year Questions: Divide and Conquer | Algorithms - Computer Science Engineering (CSE) is a part of the Computer Science Engineering (CSE) Course Algorithms.
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)
81 videos|80 docs|33 tests

Top Courses for Computer Science Engineering (CSE)

FAQs on Previous Year Questions: Divide and Conquer - Algorithms - Computer Science Engineering (CSE)

1. What is the Divide and Conquer algorithm?
Ans. The Divide and Conquer algorithm is a problem-solving technique where a problem is divided into smaller subproblems which are then solved independently. The solutions to the subproblems are then combined to solve the larger problem.
2. What are the three steps involved in the Divide and Conquer approach?
Ans. The three steps involved in the Divide and Conquer approach are: 1. Divide: Break the problem into smaller subproblems. 2. Conquer: Solve the subproblems recursively. 3. Combine: Combine the solutions of the subproblems to solve the original problem.
3. Can you provide an example of a problem that can be solved using the Divide and Conquer technique?
Ans. An example of a problem that can be solved using the Divide and Conquer technique is the Merge Sort algorithm. In Merge Sort, the array is divided into two halves, sorted recursively, and then merged back together in a sorted manner.
4. What are some advantages of using the Divide and Conquer approach in problem-solving?
Ans. Some advantages of using the Divide and Conquer approach include improved efficiency, easier implementation, and better code readability. It also allows for parallelization of tasks, making it suitable for use in multi-core processors.
5. Are there any limitations to using the Divide and Conquer technique?
Ans. One limitation of the Divide and Conquer technique is that it may not be suitable for all types of problems, especially those that do not have a clear division into subproblems. Additionally, there may be overhead associated with combining the solutions of the subproblems.
81 videos|80 docs|33 tests
Download as PDF
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

mock tests for examination

,

shortcuts and tricks

,

Exam

,

video lectures

,

Previous Year Questions: Divide and Conquer | Algorithms - Computer Science Engineering (CSE)

,

Sample Paper

,

Important questions

,

past year papers

,

ppt

,

Extra Questions

,

Objective type Questions

,

MCQs

,

Viva Questions

,

Previous Year Questions with Solutions

,

practice quizzes

,

Semester Notes

,

Previous Year Questions: Divide and Conquer | Algorithms - Computer Science Engineering (CSE)

,

pdf

,

Free

,

Summary

,

Previous Year Questions: Divide and Conquer | Algorithms - Computer Science Engineering (CSE)

,

study material

;