Code Explainers
Code explainers tagged #algorithms
python
import time import threading
How a thread-safe token bucket rate limiter works
rate-limiting
concurrency
locking
Intermediate
6 steps
python
from collections import deque def bfs(graph, start):
Breadth-first search and shortest paths in Python
graph-traversal
bfs
queue
Intermediate
9 steps
java
import java.util.*; public class TopologicalSort {
Topological sort with Kahn's algorithm
graphs
topological-sort
bfs
Intermediate
6 steps
java
import java.util.Arrays; public class SlidingWindow { // Returns the maximum sum of any contiguous subarray of length k.
The sliding window technique in Java
sliding-window
arrays
algorithms
Intermediate
8 steps
ruby
# Binary search using Ruby's built-in Array#bsearch. # # There are two modes: # 1. find-minimum mode -> block returns true/false (monotonic)
Binary search patterns with Ruby's bsearch
binary-search
algorithms
ranges
Intermediate
7 steps