<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Algorithm on wid's blog</title><link>https://wid-blog.github.io/en/posts/tech/algorithm/</link><description>Recent content in Algorithm on wid's blog</description><generator>Hugo</generator><language>en</language><lastBuildDate>Thu, 09 Jul 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://wid-blog.github.io/en/posts/tech/algorithm/index.xml" rel="self" type="application/rss+xml"/><item><title>Top-K — Heap Is Not Always the Answer</title><link>https://wid-blog.github.io/en/posts/tech/algorithm/top-k-heap-vs-quickselect/</link><pubDate>Thu, 09 Jul 2026 00:00:00 +0000</pubDate><guid>https://wid-blog.github.io/en/posts/tech/algorithm/top-k-heap-vs-quickselect/</guid><description>A heap is the reflex answer to K-th largest problems, but when the whole array is already in memory, Quick Select is faster on average. The size-K heap and Quick Select mechanics, and how the shape of the data decides between them.</description></item><item><title>Union-Find — Two Optimizations Make It Practically Constant</title><link>https://wid-blog.github.io/en/posts/tech/algorithm/union-find/</link><pubDate>Sat, 04 Jul 2026 00:00:00 +0000</pubDate><guid>https://wid-blog.github.io/en/posts/tech/algorithm/union-find/</guid><description>Union-Find gives each group a root representative and decides whether two elements share a group. The unoptimized version stretches find to O(N) on chain trees; path compression and union by rank make it practically constant.</description></item><item><title>Topological Sort — Process Zero In-degree First</title><link>https://wid-blog.github.io/en/posts/tech/algorithm/topological-sort/</link><pubDate>Fri, 03 Jul 2026 00:00:00 +0000</pubDate><guid>https://wid-blog.github.io/en/posts/tech/algorithm/topological-sort/</guid><description>Kahn&amp;rsquo;s BFS for topological sort repeatedly takes nodes with zero in-degree, and cycle detection comes along without extra logic. The mechanism, the Course Schedule problems, and the selection criteria against DFS post-order.</description></item><item><title>Sliding Window and Prefix Sum — When Monotonicity Decides</title><link>https://wid-blog.github.io/en/posts/tech/algorithm/sliding-window-and-prefix-sum/</link><pubDate>Sun, 14 Jun 2026 00:00:00 +0000</pubDate><guid>https://wid-blog.github.io/en/posts/tech/algorithm/sliding-window-and-prefix-sum/</guid><description>Subarray-sum problems collapse from O(N²) to O(N) along two paths — sliding window or prefix sum with a hash. Negative inputs or strict-equality conditions break monotonicity and shift the work from sliding window to prefix sum.</description></item><item><title>Parametric Search — Binary-search the Answer</title><link>https://wid-blog.github.io/en/posts/tech/algorithm/parametric-search/</link><pubDate>Sat, 13 Jun 2026 00:00:00 +0000</pubDate><guid>https://wid-blog.github.io/en/posts/tech/algorithm/parametric-search/</guid><description>When the answer isn&amp;rsquo;t sitting in any array, you can still binary-search the answer itself. The parametric-search recipe — define the decision function, fix the direction of monotonicity, justify lo and hi.</description></item></channel></rss>