Skip to content

Conversation

@mdrazak2001
Copy link
Contributor

C++ Implementation of 207. Course Schedule
This problem is equivalent to detecting a cycle in the directed graph represented by prerequisites. Both BFS and DFS can be used to solve it using the idea of topological sort. Since pair<int, int> is inconvenient for implementing graph algorithms, we first transform it to the adjacency-list representation. If course u is a prerequisite of course v, then the adjacency list of u will contain v.
I have used DFS to solve this problem.

@mdrazak2001 mdrazak2001 changed the title Adding C++ Implementation Adding C++ Implementation for 207.Course Schedule Aug 18, 2021
@begeekmyfriend begeekmyfriend merged commit 0cb3b84 into begeekmyfriend:master Aug 18, 2021
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