An implementation of divide and conquer algorithms using python.
Divide-and-conquer is a top-down technique for designing algorithms that consists of dividing the problem into smaller subproblems hoping that the solutions of the subproblems are easier to find and then composing the partial solutions into the solution of the original problem.
What do you mean by divide and conquer strategy?
A divide and conquer strategy, also known as “divide and rule strategy” is often applied in the arenas of politics and sociology. In this strategy, one power breaks another power into smaller, more manageable pieces, and then takes control of those pieces one by one.
## MERGESORT:
Merge sort is a sorting technique based on divide and conquer technique.
With worst-case time complexity being Ο(n log n), it is one of the most respected algorithms.
Merge sort first divides the array into equal halves and then combines them in a sorted manner.
## QUICKSORT:
Quick sort is a highly efficient sorting algorithm and is based on partitioning of array of data into smaller arrays.
A large array is partitioned into two arrays one of which holds values smaller than the specified value, say pivot,
based on which the partition is made and another array holds values greater than the pivot value.
Quick sort partitions an array and then calls itself recursively twice to sort the two resulting subarrays.
This algorithm is quite efficient for large-sized data sets as its average and worst case complexity are of Ο(nlogn),
where n is the number of items.