Book Image

Parallel Programming with Python

By : Jan Palach, Jan Palach V Cruz da Silva
Book Image

Parallel Programming with Python

By: Jan Palach, Jan Palach V Cruz da Silva

Overview of this book

Table of Contents (16 chapters)
Parallel Programming with Python
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

The divide and conquer technique


When you face a complex issue, the first thing to be done is to decompose the problem in order to identify parts of it that may be handled independently. In general, the parallelizable parts in a solution are in pieces that can be divided and distributed for them to be processed by different workers. The technique of dividing and conquering involves splitting the domain recursively until an indivisible unit of the complete issue is found and solved. The sort algorithms, such as merge sort and quick sort , can be resolved by using this approach.

The following diagram shows the application of a merge sort in a vector of six elements, making the divide and conquer technique visible:

Merge sort (divide and conquer)