Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Upload the program(s) together with a description file (text, DOC or PDF) on how to execute it.) Problem 1. [ 12 points] An inclusive scan

(Upload the program(s) together with a description file (text, DOC or PDF) on how to execute it.)

Problem 1. [ 12 points] An inclusive scan operation takes a binary associative operator , and an input array of n elements [x0, x1, ..., xn-1], and returns the output array

[x0,(x0 x1),...,(x0 x1 ...xn-1)] For example, if is addition, then an inclusive scan operation on the input array [3 1 7 1 5 1 5 3] would return [3 4 11 12 16 17 23 26].

Consider that a very large array is made available to several processes and each process requests a positive integer amount of the array for exclusive use (like slicing bread). That number must be randomly generated by each process and must be odd.

Write a single program that displays the indexes of the array allocated to these processes. The index of the array starts at 1.

For example, if we have 8 processes and the request of the processes is [3 1 7 1 5 1 5 3] then process 0 will receive the array portion between index 1-3

process 1 will receive the array portion between index 4-4

process 2 will receive the array portion between index 5-11

process 3 will receive the array portion between index 12-12

process 4 will receive the array portion between index 13-17

process 5 will receive the array portion between index 18-18

process 6 will receive the array portion between index 19-23

process 7 will receive the array portion between index 24-26

in C++

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions

Question

4. Does cultural aptitude impact ones emotional intelligence?

Answered: 1 week ago

Question

7. Do the organizations social activities reflect diversity?

Answered: 1 week ago