Question: java multithreading. For the multi-threaded search, you need to split the array into smaller sub-arrays. Instead of creating new arrays of smaller size, you should
java multithreading.
For the multi-threaded search, you need to split the array into smaller sub-arrays. Instead of creating new arrays of smaller size, you should pass the start and end indexes into your threads constructor and only search the specified subarray in the thread. Start off with splitting the array into 4 subarrays, and then instantiate a new thread for each subarray where you will do a linear search. If you find the value, return the index and print out the amount of time that elapsed. Note that your other threads will probably still be running, but we dont care about the time for all the threads to complete we only care about the time it takes to find the random number. If you didnt find the number, then print out the total time for all the threads to complete.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
