Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 20, 2025
1 parent e3c6e81 commit 7a2ee6e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sorts/topological_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
}
vertices: list[str] = ["a", "b", "c", "d", "e"]


class Topo:
def topo_sort(self):
visited = set()
stack = []

def dfs(node):
visited.add(node)

Expand All @@ -26,9 +28,9 @@ def dfs(node):
dfs(neighbor)

stack.append(node)

return stack

result = dfs("a")
return result[::-1]

Expand Down

0 comments on commit 7a2ee6e

Please sign in to comment.