src/test/java/edu/neu/coe/info6205/union_find/Alternative2.java
private void validate(int p) {
        int n = parent.length;
        if (p < 0 || p >= n) {
            throw new IllegalArgumentException("index " + p + " is not between 0 and " + (n - 1));
        }
    }
// validate that p is a valid index
validate that p is a valid index
validate that p is a valid index
private void validate(int p) {
        int n = parent.length;
        if (p < 0 || p >= n) {
            throw new IllegalArgumentException("index " + p + " is not between 0 and " + (n - 1));
        }
    }
private void validate ( int p ) { int n = parent . length ; if ( p < 0 || p >= n ) { throw new IllegalArgumentException ( "index " + p + " is not between 0 and " + ( n - 1 ) ) ; } }
validate that p is a valid index
validate that p is a valid index