Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

my First assignment on algorithm percolation1 #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rasheey97-alt
Copy link

No description provided.

Copy link

@erictoguem erictoguem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please could you implement all methods, while respecting the method signature, but most important having the method does what it is supposed to do.

flow(isOpen, isFull, 0, j);
}
return isFull;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not isOpen is supposed to do, it should just check the site is open.

flow(isOpen, isFull, i, j-1); // left
flow(isOpen, isFull, i-1, j); // up
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method doesn't determine full site, but just mark as full any site that is open, and this is not the definition of a full site, which is: 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.

for (int j = 0; j < n; j++) {
if (isFull[n-1][j]) return true;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the isFull was actually returning full sites, then your method would be working. However, it would have not respected performance requirements, as this check is O(n) not constant and flow is not constant also.


// does the system percolate?
public static boolean percolates(boolean[][] isOpen) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

percolates is not supposed to take any parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants