Skip to content

Maple: Rhyannon Rodriguez#47

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

Maple: Rhyannon Rodriguez#47
rhyannonjoy wants to merge 1 commit intoAda-C16:masterfrom
rhyannonjoy:master

Conversation

@rhyannonjoy
Copy link

asked another student for help

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, Rhyannon. It looks like you've got a good understanding of BFS, including the time complexity. Let me know what questions you have.

🟢

Comment on lines +8 to +11
Time Complexity: Generally Linear O(N), but more specifically
O(N+E) or O(V+E), in which E is edges & V for vertices,
Space Complexity: We're initializing 3 new data structures ->
performance depends on the length of these sets, Linear O(N)

Choose a reason for hiding this comment

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

💫🦴 Thanks for defining your variables and constraints!

Comment on lines +22 to +25
if dislikes[0]:
start_node = 0
else:
start_node = 1

Choose a reason for hiding this comment

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

🤔 Consider a case where the graph has multiple nodes disconnected and they are all indexed at the beginning of the adjacency list dislikes. For example:
dislikes = [ [], [], [], [4, 5], [5,1], [3]]. How might you refactor your code to account for this edge case?

visited.add(start_node)
red.add(start_node)

while len(queue) != 0:

Choose a reason for hiding this comment

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

💫🐩 Really clear BFS solution nice!

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