Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7773381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:07:23+00:00 2026-06-01T17:07:23+00:00

I want to implement the parallel prefix sum algorithm using C++. My program should

  • 0

I want to implement the parallel prefix sum algorithm using C++. My program should take the input array x[1....N],and it should display the output in the array y[N]. (Note the maximum value of N is 1000.)

So far, I went through many research papers and even the algorithm in Wikipedia.
But my program should also display the output, the steps and also the operations/instructions of each step.

I want the fastest implementation like I want to minimise the number of operations as well as the steps.

For example::

x = {1, 2, 3,  4,   5,   6,   7,  8 } - Input
y = ( 1, 3, 6, 10, 15, 21, 28, 36) - Output

But along with displaying the y array as output, my program should also display the operations of each step. I also refer this thread calculate prefix sum ,but could get much help from it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:07:24+00:00Added an answer on June 1, 2026 at 5:07 pm

    Following piece of code will do the job

    void prfxSum()
    {
        int *x=0;
        int *y=0;
        int sum=0;
        int num=0;
        int i=0;
    
        cout << "Enter the no. of elements in input array : ";
        cin >> num;
    
        x = new int[num];
        y = new int[num];
    
        while(i < num)
        {
            cout << "Enter element " << i+1 << " : ";
            cin >> x[i++];
        }
    
        cout << "Output array :- " << endl;
        i = 0;
        while(i < num)
        {
            sum += x[i];
            y[i] = sum;
            cout << y[i++] << ", ";
        }
    
        delete [] x;
        delete [] y;
    }
    

    Following is the output on execution

    Enter the no. of elements in input array : 8
    Enter element 1 : 1
    Enter element 2 : 2
    Enter element 3 : 3
    Enter element 4 : 4
    Enter element 5 : 5
    Enter element 6 : 6
    Enter element 7 : 7
    Enter element 8 : 8
    Output array :- 
    1, 3, 6, 10, 15, 21, 28, 36
    

    You can avoid the user input of 1000 elements of array x[] by feeding it from file or so.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to implement my particle filtering algorithm in parallel in Common Lisp. Particle
I am trying to implement a modified parallel depth-first search algorithm in Erlang (let's
I want to implement parallel coordinates for my muldimensional result. Does anyone have a
I want implement in my software solution an VBA editor but in c# 3.0.
given this class definition: public class Frame { IFrameStream CapturedFrom; } I want implement
Microsoft has announce that WindowsLiveID become a OpenID provider . I want implement it
I want to implement an autocomplete feature with images in my website. I would
I want to implement file uploading with behaviour which is commonly seen in various
I want to implement a function in the base class but I also want
I want to implement a Facebook updates(user action and notifications) on my web application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.