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

Paper- Glenda C #5

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

Paper- Glenda C #5

wants to merge 1 commit into from

Conversation

GClenda
Copy link

@GClenda GClenda commented Nov 12, 2021

No description provided.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

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

Nice work Glenda, you hit the learning goals here. Well done.

Comment on lines +14 to +19
def dfs(v, c):
visited[v] = True
color[v] = c
for u in dislikes[v]:
if not visited[u]:
dfs(u, 1 - c)

Choose a reason for hiding this comment

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

Nice little helper function

Comment on lines +8 to +9
Time Complexity: O(n^2)
Space Complexity: O(n)

Choose a reason for hiding this comment

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

👍 But I think the time complexity is O(NE) where N is the number of nodes and E the number of edges. I suppose in a fully connected graph it would approach O(n^2)

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