Question: Submit the pseudo-code & java source code, please I have a list of face values of 100 dice rolls. Since a dice has 6 face
Submit the pseudo-code & java source code, please
I have a list of face values of 100 dice rolls. Since a dice has 6 face values: 1, 2, 3, 4, 5, 6 the list will only contain these six numbers. Can you make use of this fact, that the array will contain only numbers 1 through 6 to devise a sorting alogrithm, to sort this list of 100 numbers?
Hint: Counting the number of occurrences of those numbers may lead to a sorting algorithm.
(a) Device an algorithm to sort this list of 100 values.
(b) Using Big O notation, what is the the efficiency of your algorithm.
(c) Write the java code to implement the above algorithm.
The class name must be Test3
The list of 100 values of dice roll should be named diceRolls
Solution must include the following methods:
static setDiceRolls(int[] dr): void
-- it populates the array diceRolls with random numbers from 1 to 6, inclusive.
staticprintDiceRolls(int[] dr): void -- prints the array in 10 rows and 10 columns. static sortDiceRolls(int[] dr): void
-- it will sort the array diceRolls. This method uses another method, countFaceOccurrence() that returns an array with number of times each face values occur.
static countFaceOccurrence(int[] dr): int[]
For sortDiceRolls method, please provide the Big O analysis.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
