Analysis
Implement PercolationUF
using the quick find data structure (QuickFind.java) and by creating a version using the weighted quick union with path compression data structure.
Adapt the code from class or WeightedQuickUnionUF.java to create
QuickUWPC.java
which implements the IUnionFind interface. Run
PercolationStats
to gather timings for
PercolationDFS
PercolationUF
with QuickFind
PercolationUF
with QuickUWPC
In your README, you will answer the following questions.
- How does doubling N affect the running time?
- How does doubling T affect the running time?
- Measure running time (using calls to System.currentTimeMillis) of the three
versions of your program (DFS, Quick Find, and weighted quick union with path
compression).
- Give a formula (using Big-Oh notation) of the running time on your
computer (in seconds) as a function of both N and T.
- Estimate the largest
experiment you could perform in one [minute, day, year] assuming your computer has
enough memory.
- Give a formula (using Big-Oh notation) that describes the amount of
memory (in bytes) that your IPercolate object consumes as a function of N for DFS,
Quick Find, and weighted quick union with path
compression).