Description
Question 1 [50 points]
Implement a C solution to the following problem using the Pthreads POSIX Standard.
Question 2: [50 points]
Implement a Java solution to the following problem by defining a class that implements the
Runnable interface.
Problem Description
Write a multithreaded program that identifies the row or the column of an array that contains the
largest repetition of a letter, whatever that letter is. Taking as input a 7×7 two-dimensional array
of characters, your program is to count, for each row and each column, how many occurrences of
each letter it observed. Once all the rows and all the columns have been accounted for, the
algorithm outputs the winner (or winners, in case of a tie).
The parent thread will create 14 worker threads, each of which will search a row or a column of
the array and store the count for each letter in each row and in each column in a common data
structure. Once all the threads have completed their computation, the parent thread will search
the common data structure for the largest count(s) and output the identity of the winning
row(s)/column(s) as well as the letter(s) they won on.
Have Fun and Good Luck!!!!!!
(See the next page for an illustration)
Illustration
Consider the following 7×7 array:
T C L A S Q U
R L E T T U S
E A T R E E S
E S K A T U T
C S Q U A E A
A R R A Y M C
C R S Q Y V K
Your program must output:
Row 3: 3 occurrences of letter E
Column 4: 3 occurrences of letter A