Week 4 Discussion Forum

Divide and Conquer

Divide and Conquer

by Md. Touhedur Rahman Khan Zihad 192-15-2775 -
Number of replies: 0

Divide and Conquer is an algorithm strategy which divide the problem into a set of sub problem and solve every sub problem individually and recursively.

The three examples of Divide and Conquer –

1.     Binary Search

2.     Quick Sort

3.     Merge Sort

Binary Search: Search a sorted array by repeatedly dividing the search interval in half. Begin with an interval covering the whole array. Its complexity is O(Log n)

Quick Sort: It works by selecting a 'pivot' element from the array and partitioning the other elements into two sub-arrays, according to whether they are less than or greater than the pivot. The sub-arrays are then sorted recursively. Its complexity is O(n) for worst case and O( n log n) for best case.

Merge Sort: Merge sort first divides the array into equal halves and then combines them in a sorted manner. Worst case complexity O(n log n).


149 words