Percolation/Site percolation - Rosetta Code

# Percolation simulation dating,

Each program should include its own main that tests the associated operations. If you have not already done so, download StdDraw.

Take a number of trials as command-line parameter and add a loop to perform that many trials. You may not call any Java library functions. Do your experiments validate or refute the hypothesis that the running time is approximately a linear function of the number of cells? The primary goal of this assignment is to introduce you to basic tools for understanding the effect of algorithm performance on completing a typical programming task.

Substitute implementations of weighted quick-union and weighted quick-union with path compression either halving or full path compression and run the same percolation simulation dating as above. Starting at by with 10 trials, double the grid dimension until the running time is about 20 seconds on your computer.

You are encouraged to get started, but please check again on Monday for the final version. Then modify the program to do multiple experiments: BLUE, as in this picture.

Knowing that it works properly for a by grid gives some confidence that it works for a by grid.

It fills random squares in an initially empty grid until the top row is connected to the bottom row, using the quick-union algorithm to detect connectivity. Observe the comparative performance characteristics of the three algorithms. The final version will be ready on the morning of Monday, February Submit your modified Percolation.

You may use the code from the lecture notes or implement your own versions. Percolation and Union-Find Write a program to estimate the value of the percolation constant by simulation.

The running time of Percolation. Develop and validate a model for the running time of your program when using quick-union, as a function of the number of cells.

Your first task is to modify this code to display all of the squares that are connected to top and bottom in StdDraw. The purpose of having this program is to serve as a large-scale trace to make sure that your code works on reasonable-sized inputs.

Use StdStats to print the sample mean and standard deviation of the observed percolation constant. How accurate is your estimate of the percolation constant? Does increasing the number of trials substantially improve the sample standard deviation?