<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US">
  <title>GyanDev</title>
  <subtitle>Deep technical notes for modern developers.</subtitle>
  <link rel="self" href="https://gyandev.org/atom.xml" />
  <link rel="alternate" href="https://gyandev.org" />
  <id>https://gyandev.org/</id>
  <updated>2026-04-24T00:00:00.000Z</updated>
  <author><name>Sonu Shahuji</name></author>
  <entry>
    <title>Heaps &amp; Priority Queues</title>
    <link href="https://gyandev.org/courses/dsa/" />
    <id>https://gyandev.org/courses/dsa/</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Pattern-first mastery of heap problems — the complete-binary-tree mental model, canonical templates, and 16 FAANG-grade patterns in Python and TypeScript.</summary>


  </entry>
  <entry>
    <title>Frequency-based</title>
    <link href="https://gyandev.org/courses/dsa/heaps" />
    <id>https://gyandev.org/courses/dsa/heaps</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Heap ordered by counts — top-K elements by frequency or reorderings that respect frequency caps.</summary>


  </entry>
  <entry>
    <title>Frequency Sort</title>
    <link href="https://gyandev.org/courses/dsa/heaps/frequency-based" />
    <id>https://gyandev.org/courses/dsa/heaps/frequency-based</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Sort array elements by descending frequency — count with a hash map, then pop from an uncapped max-heap and emit each value that many times.</summary>


  </entry>
  <entry>
    <title>Top K Frequent Elements</title>
    <link href="https://gyandev.org/courses/dsa/heaps/frequency-based" />
    <id>https://gyandev.org/courses/dsa/heaps/frequency-based</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Return the K most frequently occurring values in an array — count with a hash map, then Top-K with a min-heap keyed on frequency.</summary>


  </entry>
  <entry>
    <title>Heaps — Fundamentals</title>
    <link href="https://gyandev.org/courses/dsa/heaps" />
    <id>https://gyandev.org/courses/dsa/heaps</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Foundations of binary heaps and priority queues — index arithmetic, operations, recognition signals, and the five templates that unlock every heap problem.</summary>


  </entry>
  <entry>
    <title>Greedy Combine</title>
    <link href="https://gyandev.org/courses/dsa/heaps" />
    <id>https://gyandev.org/courses/dsa/heaps</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Repeatedly extract the two smallest, combine, and reinsert — Huffman-style accumulation.</summary>


  </entry>
  <entry>
    <title>Connect Ropes with Minimum Cost</title>
    <link href="https://gyandev.org/courses/dsa/heaps/greedy-combine" />
    <id>https://gyandev.org/courses/dsa/heaps/greedy-combine</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Repeatedly merge the two shortest ropes into one — a Huffman-style greedy that minimises total joining cost using a min-heap.</summary>


  </entry>
  <entry>
    <title>K-way Merge</title>
    <link href="https://gyandev.org/courses/dsa/heaps" />
    <id>https://gyandev.org/courses/dsa/heaps</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Merge K sorted sequences or matrix cells by maintaining a heap of active heads.</summary>


  </entry>
  <entry>
    <title>Kth Smallest in Sorted Matrix</title>
    <link href="https://gyandev.org/courses/dsa/heaps/k-way-merge" />
    <id>https://gyandev.org/courses/dsa/heaps/k-way-merge</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Find the K-th smallest value in a row- and column-sorted matrix by treating rows as K sorted lists and applying the K-way merge template.</summary>


  </entry>
  <entry>
    <title>Merge K Sorted Lists</title>
    <link href="https://gyandev.org/courses/dsa/heaps/k-way-merge" />
    <id>https://gyandev.org/courses/dsa/heaps/k-way-merge</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Merge K sorted linked lists or arrays into one sorted output using a min-heap seeded with the head of each source — the canonical K-way merge.</summary>


  </entry>
  <entry>
    <title>Scheduling with Heap</title>
    <link href="https://gyandev.org/courses/dsa/heaps" />
    <id>https://gyandev.org/courses/dsa/heaps</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Greedy task/interval picks driven by a priority queue — cooldowns, deadlines, room assignment.</summary>


  </entry>
  <entry>
    <title>Maximum Beauty with Deadlines</title>
    <link href="https://gyandev.org/courses/dsa/heaps/scheduling-with-heap" />
    <id>https://gyandev.org/courses/dsa/heaps/scheduling-with-heap</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Maximise total beauty of toys sold within per-toy deadlines — sort by deadline, then use a min-heap as capacity-bounded beauty tracker.</summary>


  </entry>
  <entry>
    <title>Meeting Rooms II (Heap)</title>
    <link href="https://gyandev.org/courses/dsa/heaps/scheduling-with-heap" />
    <id>https://gyandev.org/courses/dsa/heaps/scheduling-with-heap</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Find the minimum conference rooms needed for a meeting list — sort by start, keep end-times in a min-heap, reuse the earliest-free room.</summary>


  </entry>
  <entry>
    <title>Reorganize String</title>
    <link href="https://gyandev.org/courses/dsa/heaps/scheduling-with-heap" />
    <id>https://gyandev.org/courses/dsa/heaps/scheduling-with-heap</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Rearrange a string so no two adjacent characters are equal by greedily emitting the most-frequent available character and deferring the one just used.</summary>


  </entry>
  <entry>
    <title>Task Scheduler</title>
    <link href="https://gyandev.org/courses/dsa/heaps/scheduling-with-heap" />
    <id>https://gyandev.org/courses/dsa/heaps/scheduling-with-heap</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Compute the minimum CPU cycles to finish a task list with a same-task cooldown using a max-heap of remaining counts plus a cooldown queue.</summary>


  </entry>
  <entry>
    <title>Top K Selection</title>
    <link href="https://gyandev.org/courses/dsa/heaps" />
    <id>https://gyandev.org/courses/dsa/heaps</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Bounded-size heap + linear scan. Opposite-polarity rule: min-heap for K-largest, max-heap for K-smallest.</summary>


  </entry>
  <entry>
    <title>K Closest Elements to X</title>
    <link href="https://gyandev.org/courses/dsa/heaps/top-k-selection" />
    <id>https://gyandev.org/courses/dsa/heaps/top-k-selection</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Return the K values closest to target X by absolute difference using a size-K max-heap keyed on distance.</summary>


  </entry>
  <entry>
    <title>K Closest Points to Origin</title>
    <link href="https://gyandev.org/courses/dsa/heaps/top-k-selection" />
    <id>https://gyandev.org/courses/dsa/heaps/top-k-selection</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Find the K points closest to (0, 0) using a size-K max-heap on squared Euclidean distance — no sqrt required.</summary>


  </entry>
  <entry>
    <title>Kth Largest Element</title>
    <link href="https://gyandev.org/courses/dsa/heaps/top-k-selection" />
    <id>https://gyandev.org/courses/dsa/heaps/top-k-selection</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Find the K-th largest element in an unsorted array using a bounded min-heap of size K — the canonical Top-K template.</summary>


  </entry>
  <entry>
    <title>Kth Smallest Element</title>
    <link href="https://gyandev.org/courses/dsa/heaps/top-k-selection" />
    <id>https://gyandev.org/courses/dsa/heaps/top-k-selection</id>
    <published>2026-04-24T00:00:00.000Z</published>
    <updated>2026-04-24T00:00:00.000Z</updated>
    <author><name>Sonu Shahuji</name></author>
    <summary>Find the K-th smallest element in an unsorted array with a bounded max-heap of size K — the mirror of the K-th largest template.</summary>


  </entry>
</feed>
