Skip to content

Arcila Maple C16#42

Open
arcila13 wants to merge 2 commits intoAda-C16:masterfrom
arcila13:master
Open

Arcila Maple C16#42
arcila13 wants to merge 2 commits intoAda-C16:masterfrom
arcila13:master

Conversation

@arcila13
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@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! I left a comment on your space complexity, but overall it looks like you have a good understanding of BFS. Let me know what questions you have.

🟢

Time Complexity: ?
Space Complexity: ?
Time Complexity: O(N+E)
Space Complexity: O(N+E)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🪐 Space complexity would actually be O(N) here since the two data structures you are creating are a graph that will hold an integer value for each of N nodes in dislikes and the queue will similarly hold at most N nodes.

group = {}
dog_que = deque()

for dog in range(len(dislikes)):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🐩 Very nice BFS solution!

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