package LongestSequenceGradingCode;
/**
* A parallel implementation of an algorithm to find the longest contiguous subsequence
* of a specified value in an integer array using Java's Fork/Join framework.
*
* The parallelism is controlled by a threshold parameter which determines
* when to stop splitting the array and perform the computation sequentially.
*
* This class is designed for benchmarking and testing parallel performance with different
* thresholds and array sizes. It should be used with ForkJoinPool#invoke to initiate
* parallel processing.
*
* The algorithm is inspired by material from page 27 of the Grossman Fork/Join notes.
*
*
* @author Unknown
* @version 4/14/25
*/
import java.util.concurrent.RecursiveTask;
public class LongestSequence_blank extends RecursiveTask<Result> {
int[] arr;
int low, high, value, threshold;
/**
* Constructs a parallel task to compute the longest contiguous run of a given value.
*
* @param array the input array
* @param lo lower bound index (inclusive)
* @param hi upper bound index (exclusive)
* @param val the target value to find longest streaks of
* @param thresh the threshold for sequential computation
*/
public LongestSequence_blank(int[] array, int lo, int hi, int val, int thresh) {
arr = array;
low = lo;
high = hi;
value = val;
threshold = thresh;
}
// You may want to add one or more helper methods.
public Result compute() {
// Implement me!
return null;
}
}