The collapse of a set of integers is defined as the sum of the integers in the set. Similarly, the collapse of a single integer is defined as the integer that is the sum of its digits. For example,...


The collapse of a set of integers is defined as the sum of the integers in the set. Similarly, the collapse of a single integer is defined as the integer that is the sum of its digits. For example, the collapse of the integer 134957 is 29. This can clearly be carried out recursively, until a single digit results: the collapse of 29 is 11, and its collapse is the single digit 2. The ultimate collapse of a set of integers is just their collapse followed by the result being collapsed recursively until only a single digit {0, 1, … , 9} remains. Your task is to write a program that will find the ultimate collapse of a one-dimensional array of N integers. Alternative approaches are as follows: 1. Use K computers in parallel, each adding up approximately N/K of the integers and passing its local sum to the master, which then totals the partial sums and forms the ultimate collapse of that integer. 2. Use K computers in parallel, each doing a collapse of its local set of N/K integers and passing the partial result to a master, which then forms the ultimate collapse of the partial collapses. 3. Use K computers in parallel, each doing an ultimate collapse on each one of its local set of N/K integers individually, then adding the local collapsed integers and collapsing the result recursively to obtain a single digit. Each of the K then sends its digit on to the master for final summing and ultimate collapse. 4. Use one computer to process all N integers according to any of the first three approaches. 5. Extra credit: Prove that the first three approaches are equivalent in that they produce the same digit for the ultimate collapse of the set of N integers.

May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here