Adsa Important Questions
Adsa Important Questions
word. The basic idea of this divide and conquer strategy is to break down a large complex problem into smaller more
sub-problems, solve each sub-problem individually, and then combine the results to solve the overall problem.
1. Divide: Split the original problem into smaller sub-problems that are easier to solve.
2. Conquer: Solve each sub-problem, typically by using recursion (repeating the process on the smaller
sub-problems).
3. Combine: Merge the solutions of the sub-problems to form the solution to the original problem.
Examples in Action:
1. Merge Sort:
o Problem: Sort a list of numbers.
o Divide: Split the list into two halves.
o Conquer: Sort each half recursively.
o Combine: Merge the sorted halves into a single sorted list.
2. Binary Search:
o Problem: Find a target value in a sorted array.
o Divide: Check the middle element.
o Conquer: If the target is smaller, search the left half; if larger, search the right half.
o Combine: If the target is found, return the position; if not, return failure.
1. Sorting Algorithms:
o Merge Sort: The array is divided into two halves, each half is recursively sorted, and then the
sorted halves are merged together.
o Quick Sort: The array is divided around a pivot element, with elements less than the pivot on
one side and greater on the other, then each side is recursively sorted.
2. Binary Search:
o A sorted array is repeatedly divided into halves, checking the middle element at each step,
until the target value is found or the array can no longer be divided.
3. Strassen’s Algorithm for Matrix Multiplication:
o Instead of using the conventional approach to multiply matrices, Strassen's algorithm divides
matrices into smaller submatrices and recursively multiplies them, achieving better time
complexity.