tinycodinglm / math /math-0174.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 16)
d517dc9 verified
|
Raw History Blame Contribute Delete
1.02 kB
{"type": "session", "harness": "opencode", "id": "math-0174", "name": "Graph Theory Algorithms"}
{"type": "message", "message": {"role": "system", "content": "You are an expert mathematician and programmer."}}
{"type": "message", "message": {"role": "user", "content": "Explain graph theory algorithms for competitive programming"}}
{"type": "message", "message": {"role": "assistant", "content": "BFS: shortest path unweighted. O(V+E). Queue-based layer-by-layer.\nDFS: cycle detection, connected components, topological sort, articulation points, bridges.\nDijkstra: shortest path non-negative weights. O((V+E) log V) with min-heap.\nBellman-Ford: shortest path with negative weights. O(VE). Relax all edges V-1 times.\nFloyd-Warshall: all-pairs shortest paths. O(V^3). dp[k][i][j] = min path i to j using 1..k.\nKruskal: MST. Sort edges O(E log E), union-find. Prim: MST. O((V+E) log V) with PQ.\nTopological sort: Kahn's BFS with in-degree or DFS post-order reverse.\nSCC: Tarjan's or Kosaraju's O(V+E)."}}