algorithms
algorithms copied to clipboard
Minimal examples of data structures and algorithms in Python
Implement Floyd's cycle-finding algorithm to detect the first cyclic node in a linked list. Includes a test suite for validation.
Kahn’s Algorithm provides a clear and efficient way to perform topological ordering while also offering built-in cycle detection and avoiding recursion-depth issues.
The repository currently includes DFS-based graph traversals but lacks a BFS-based implementation of Topological Sorting using Kahn’s Algorithm. Kahn’s Algorithm provides a clear and efficient way to perform topological ordering...
The current implementation is binary search in its most basic form. It can be generalized to take the range and a function (f) with boolean return value as arguments and...
This update improves the move_zeros algorithm by: - Using isinstance(i, bool) for cleaner boolean type checking - Avoiding temporary list allocation when appending zeros - Clearer inline comments of the...
- Implemented search a 2D matrix algorithm in algorithms/search/