Dana Vrajitoru
B424/B524 Parallel and Distributed Programming

B424/B524 Class Exercise 4

Date: Thursday, November 12, 2020.

Ex. 1 (2 pts.) Monte Carlo Pi

Apply the Monte Carlo algorithm to approximate the value of pi given the following distribution of the random points:

                    Inside     Outside    the circle 
(0.854, 0.955)  ____________   __________

(-0.272, 0.668) ____________   __________ 

(0.521, 0.942)  ____________   __________ 

(-0.705, -0.012)____________   __________  

(0.834, 0.018)  ____________   __________ 

(-0.794,- 0.548)____________   __________ 

(0.983, 0.602)  ____________   __________   

(0.267, 0.029)  ____________   __________ 

(-0.593, 0.263) ____________   __________

(0.637, -0.631) ____________   __________ 

Total:          ____________   __________

Approximate value of pi:
Ex. 2 (1 pt.) Subsets

Given the set of numbers {0, 1, ..., 9}, what subset does the number 0 1 1 0 1 0 1 1 1 0 represent?

Subset:

Ex. 3 (2 pts.) Next Permutation

Given the following permutation of 10 numbers, determine the next permutation in lexicographical order, using the algorithm from the PowerPoint slides / the lecture.

3 9 6 0 4 8 7 5 2 1

Next permutation:

Upload to Canvas:

Upload a file with the answers to Assignments, Exercise 4, or type it directly in the submission input box.