Skip to content

Course Schedule#106

Open
tom4649 wants to merge 2 commits into
mainfrom
207.Course-Schedule
Open

Course Schedule#106
tom4649 wants to merge 2 commits into
mainfrom
207.Course-Schedule

Conversation

@tom4649
Copy link
Copy Markdown
Owner

@tom4649 tom4649 commented May 21, 2026


## step1

DAG判定だと思う。トポロジカルソート。
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

閉路検出という言い方のほうが一般的かもしれません。

return True

for root in range(numCourses):
if not no_cycle(root, set()):
Copy link
Copy Markdown

@nodchip nodchip May 22, 2026

Choose a reason for hiding this comment

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

二重否定は読み手に取ってやや認知負荷が高くなると思います。 inner function を has_cycle() とし、

if has_cycle(root, set()):

としたほうが読み手にとって優しいと思います。

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

二重否定が認知負荷を上げるというのは覚えておきます。step2_recursion.pyを書き換えました。

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