Here is a checklist
Possible Progress Steps
Make sure that stdlib-package.jar (Links to an external site.) and algs4-package.jar (Links to an external site.). are added to the build path of your Java project. For instructions on how to do that check out CE Getting Started
Consider not worrying about backwash for your first attempt. You can revise your implementation once you have solved the problem without handling backwash.
For each method in Percolation that you must implement (open(), percolates(), etc.), make a list of which methods (QuickFindUF or WeightedQuickUnionUF) might be useful for implementing that method. This should help solidify what you’re attempting to accomplish. Do not write your own union-find data structure or algorithms.
Using the list of methods from the API as a guide, choose instance variables that you’ll need to solve the problem. Don’t overthink this, you can always change them later. Instead, use your list of instance variables to guide your thinking as you follow the steps below, and make changes to your instance variables as you go.
Plan how you’re going to map from a 2-dimensional (row, column) pair to a 1-dimensional union find object index. We recommend writing a private method to convert from 2D coordinates to 1D coordinates (instead of copying and pasting the conversion formula multiples times).
Write a private method for validating indices. Since each method is supposed to throw an exception for invalid indices, you should write a private method which performs this validation process.
Write the open() method and the Percolation() constructor. The open() method should do three things. First, it should validate the indices of the site that it receives. Second, it should somehow mark the site as open. Third, it should perform some sequence of union-find operations that links the site in question to its open neighbors. The constructor and instance variables should facilitate the open() method’s ability to do its job.
Test the open() method and the Percolation() constructor. These tests should be in main(). An example of a simple test is to create a percolation object with N = 2, then call open(0, 1) and open(1, 1), and finally to call percolates().
Write the percolates(), isOpen(), and isFull() methods. These should be very simple methods. Each of the methods (except the constructor) in Percolation must use a constant number of union-find operations. If you have a for loop inside of one of your Percolation methods, you’re probably doing it wrong. Don’t forget about the virtual-top / virtual-bottom trick described in lecture.
Test your complete implementation using the two visualization clients. Then when submitting, your Percolation class should use the WeightedQuickUnionUF class. If you submit with either UF orQuickFindUF, your code will fail the timing tests.
Write and test the PercolationStats class. See the stdlib.jar API for helper classes.
Programming Assignment 1: Percolation Write a program to estimate the value of the percolation threshold via Monte Carlo simulation Percolation. Given a composite systems comprised of randomly distributed insulating and metallic materials: what fraction of the materials need to be metallic so that the composite system is an electrical conductor? Given a porous landscape with water on the surface (or oil below), under what conditions wilthe water be able to drain through to the bottom (or the oil to gush through to the surface)? Scientists have defined an abstract process known as percolation to model such situations. The model. We model a percolation system using an N-by-N grid of sites. Each site is either open or blocked. A full site is an open site that can be connected to an open site in the top row via a chain of neighboring left, right, up, down) open sites. We say the system percolates if there is a ful site in the bottom row. In other words. a system percolates if we fill all open sites connected to the top row and that process fills some open site on the bottom row. (For the insulating/metallic materials example, the open sites correspond to metallic materials, so that a system that percolates has a metallic path from top to bottom, with full sites condi For the porous ucting. substance example, the open sites correspond to empty space through which water might flow. so that a system that percolates lets water fill open sites, flowing from top to bottom. does not percolate percolates open site connected to top no open site donnected to top The problem. In a famous scientific problem, researchers are interested in the following question: if sites are independently set to be open with probability p (and therefore blocked with probability 1 p), what is the probability that the system percolates? When pequals 0, the system does not percolate: when p equals 1. the system percolates. The plots below show the site vacancy probability p versus the percolation probability for 20-by-20 random grid (left) and 100-by 100 random grid (right). percolation percolation probability probability 0.593 0.593 site vacancy probability p site vacancy probability p When N is sufficiently large, the is a threshold value p such that when p p a random N-by-N grid almost never percolates, and when p p”, a random N-by-N grid almost always percolates
The post Possible Progress Steps appeared first on My Assignment Online.
Welcome to the Most Reliable Essay writing Service Online
Possible Progress Steps
Here is a checklist