In merge sort we divide in two parts while solving . Why we didn't divided it in 3 or more parts ? Similarly in many divide and conquer problems I have seen one tend to divide in two parts . Why not 3 or more parts ? What impact would it have on solution / complexity ?
Dividing the problem in 3 or more parts is usually inconvenient and has no effect on the algorithmic complexity. It will usually impact real-world performance negatively because more complicated code tends to be less efficient in practice than simple streamlined code. But this is not always the case.
There are a few practical D&C algorithms that divide the problem in more than two parts because it's beneficial to do so. The dual-pivot quicksort is one example. It tends to be somewhat faster (by a constant factor) than the regular quicksort.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With