Skip to content

Spruce - Rebecca Z#43

Open
rzuick wants to merge 1 commit intoAda-C16:masterfrom
rzuick:master
Open

Spruce - Rebecca Z#43
rzuick wants to merge 1 commit intoAda-C16:masterfrom
rzuick:master

Conversation

@rzuick
Copy link

@rzuick rzuick commented Jul 22, 2022

No description provided.

Copy link

@kyra-patton kyra-patton 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, Rebecca. I left a comment about the time complexity, but overall it looks like you have a good understanding of breadth first search. Let me know what questions you have.

🟢

into the same partition.
Time Complexity: ?
Space Complexity: ?
Time Complexity: O(VE)

Choose a reason for hiding this comment

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

⏱ Time complexity will actually be O(V + E) where V is the number of vertices (or dogs) in the graph represented by the adjacency list dislikes and E is the total number of edges in the graph. This is because you are traversing each node and each edge once.

A time complexity of O(VE) would mean that for each of the vertices, you have to traverse all of the edges in the entire graph.

visited.add(0)
group1.add(0)

while len(queue) > 0:

Choose a reason for hiding this comment

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

🐩 Nice BFS implementation

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