Create a performance-testing client that executes T trials of the following experiment using an int value T from the command line: Use UnionFind to identify connectivity as in our development client, and loop until all sites are connected, to create the connections in an N-by-N square grid with random orientation and order. Print the value of N, the average number of connections handled, and the running duration relative to the previous value for each N. Use your programme to verify the text's assertions that weighted quick-union is almost linear and that quick-find and quick-union have quadratic running times. Note : As N doubles, the number of sites in the grid increases by a factor of 4, so expect a doubling factor of 16 for quadratic and 4 for linear.
Create a performance-testing client that executes T trials of the following experiment using an int value T from the command line: Use UnionFind to identify connectivity as in our development client, and loop until all sites are connected, to create the connections in an N-by-N square grid with random orientation and order. Print the value of N, the average number of connections handled, and the running duration relative to the previous value for each N. Use your programme to verify the text's assertions that weighted quick-union is almost linear and that quick-find and quick-union have quadratic running times. Note : As N doubles, the number of sites in the grid increases
by a factor of 4, so expect a doubling factor of 16 for quadratic and 4 for linear.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps