Class RecursiveTaskSum

All Implemented Interfaces:
Serializable, Future<Double>

public class RecursiveTaskSum extends RecursiveTask<Double>

Parallel Array Summation (Fork/Join)

Implements a parallel reduction strategy using RecursiveTask to compute the mathematical sum of an array of double primitives. It splits the array into sub-segments until they fall within a specific sequential threshold, then aggregates fractional calculations up the execution tree.

Complexity

  • Time Complexity: O(N) - Distributed work over P cores reduces real-world processing duration near to O(N/P).
  • Space Complexity: O(log N) - Stack consumption matches the binary tree depth during splitting.
Author:
vicegd
See Also:
  • Constructor Details

    • RecursiveTaskSum

      public RecursiveTaskSum(double[] data, int start, int end)
      Initializes a sum task for a dedicated boundary segment of the array.
      Parameters:
      data - The source numerical array.
      start - The inclusive starting boundary index.
      end - The exclusive ending boundary index.
  • Method Details