0
$\begingroup$

I am trying to write an efficient Parallelised algorithm for Data Averaging. By this I mean I have a list of tuples (K, V1, V2, V3) and in the end, I want a dictionary mapping K to the average of all V1, V2 and V3 present in the list with K.

If anyone can think of something it would be much appreciated.

Thanks, Harris Mirza

$\endgroup$
1
$\begingroup$

The role of three values $V_1, V_2$ and $V_3$ isn't clear for me, but anyway:

  • Step 1. Sort the original list in parallel by key $K$ - you'll get a list of records $(K, V_1, V_2, V_2)$, where all the records with the same key are stored together in "buckets".
  • Step 2. Process each bucket concurrently, calculating all the averages.

There are many parallel sorting algorithms, you can choose one depending on your computational model.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.