Question
JAVA programs for both questions Question # 1: Make BucketSort.java, a program that takes an arbitrary file of doubles from standard input, then outputs them
JAVA programs for both questions
Question # 1: Make BucketSort.java, a program that takes an arbitrary file of doubles from standard input, then outputs them in ascending order, using the algorithm discussed in class. Your program should read the data into a java.util.ArrayList; use small ArrayLists (rather than linked lists) for the buckets; and merge the buckets back into the original ArrayList before outputting the results.
More instructions: The algorithm is expected to be O(n) time. Example: You have N keys in range 0.0 <= x < 1.0 Uniformly distributed N=100 aka 100 buckets Buckets: .00) .01) .012 .02) .023, .022 .03) ..... .10) ..... .50) ..... .99) Call the buckets b0, b1, .. bn-1 then each bi corresponds to i/N <= x < i+1/N Insert sort every bucket
Question # 2:
The dice game Crown and Anchor was described in class. Determine whether the game favors the house, the player, or neither, and by what percentage. You must: Solve the problem analytically (i.e., give some argument that talks about the game's probabilities). Make program CrownAndAnchor.java which answers the question using Monte Carlo simulation (of, say, ten million games). Make sure that your solutions agree with one another!
https://en.wikipedia.org/wiki/Crown_and_Anchor
Step 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