This material is part of the course Practical Introduction to Parallel Programming and meant for educational purposes only.
Task
Implement a program that uses tasks to execute a binary search algorithm in parallel. Use the sequential implementation below as the basis of your program. Print the number of the thread that has found the value in the tree.
Hints
The binary tree is not sorted; a value can be located in the left or right sub-tree of a node. You must search both sub-trees.
Do not forget to indicate which variables are private and which are shared.
Can you verify that the search operation is executed in parallel?
What happens if you vary the maximum number of threads through the environment variable OMP_NUM_THREADS
?