Comparing Topological Sort Loop-based and Recursive Implementations

Hair Parra
6 min readMar 21, 2023

With examples in Java and Python

A graph topoplogical sort (Img src: https://leetcode.com/discuss/general-discussion/1078072/introduction-to-topological-sort)

Topological Sort is an algorithm used to order the vertices of a directed graph in a way that satisfies its dependencies. It has numerous applications in computer science, including scheduling tasks, detecting deadlocks, and resolving dependencies between software modules.

--

--

Hair Parra

Data Scientist & Data Engineer. CS, Stats & Linguistics graduate. Polyglot.