tinycodinglm / math /math-0156.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 15)
b27bfb3 verified
|
Raw History Blame Contribute Delete
800 Bytes
opencode trace
System You are an expert mathematician and programmer.

You are an expert mathematician and programmer.

User

Explain Dijkstra variants

Assistant

Standard: min-heap O((V+E) log V). Lazy deletion: skip stale entries.
0-1 BFS: deque for weights {0,1}. O(V+E). Front for 0-weight, back for 1-weight.
Dial's: integer weights [0,W]. Bucket array. O(V+E+W).
State-space: dist[node][state] when node alone isn't enough (e.g., k free edges used).
Multi-source: push all sources, find nearest source per node.
Negative weights: use Bellman-Ford/SPFA, never Dijkstra.