Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I have a java code to finish, and I have no idea how to write a parallel code. Can someone solve it? Here are the
I have a java code to finish, and I have no idea how to write a parallel code. Can someone solve it?
Here are the problem and some start code.
Directions: Submit your solutions using gitlab. You must fill out the partners form for para to get access to your repository. Choosing a partner is disabled, because these exercises are solo. EX12. getLongestSequence (20 points) Use the ForkJoin framework to write the following method in Java: public static int getLongestSequence (int val, int[] arr, int sequentialCutoff Returns the length of the longest consecutive sequence of val in arr. For example, if arr is [2, 17, 17, 8, 17, 17, 17, 0, 17, 1], then getLongestSequence (17, arr)3 and getLongestSequence (35, arr) 0. Your code must have O(n) work, (lgn) span, where n is the length of arr, and actually use the sequentialCutoff argument. We have provided you with an extra class SequenceRange. We recommend you use this class as your return value, but this is not required Directions: Submit your solutions using gitlab. You must fill out the partners form for para to get access to your repository. Choosing a partner is disabled, because these exercises are solo. EX12. getLongestSequence (20 points) Use the ForkJoin framework to write the following method in Java: public static int getLongestSequence (int val, int[] arr, int sequentialCutoff Returns the length of the longest consecutive sequence of val in arr. For example, if arr is [2, 17, 17, 8, 17, 17, 17, 0, 17, 1], then getLongestSequence (17, arr)3 and getLongestSequence (35, arr) 0. Your code must have O(n) work, (lgn) span, where n is the length of arr, and actually use the sequentialCutoff argument. We have provided you with an extra class SequenceRange. We recommend you use this class as your return value, but this is not requiredStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started