Divide-and-conquer algorithms
Divide-and-conquer algorithms are made up of three steps: divide, conquer, and combine. In the divide stage, we divide the data into smaller, more manageable fragments. In the conquer stage, we dissecate each division by operating some operation on it. Finally,comes the combine stage where we reassemble the processed divisions. Merge sorts are a good example in this case.
Merge sorts are usually dealt with recursively. We operate as the music goes by dividing big problems into smaller problems making them easier to solve.
For instance we have a list of 8 numbers that we divide in half. The 4 are then divided into groups of 2 until they get isolated into a single number.
Once analysed, we can merge them by 2 into an array.
We then remerge the array into bigger array container of 4 numbers, that we will arrange in ascending order. Finally we merge the two into a single array sorting them into the right order. The array is now sorted.