<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Algorithms on Nalar</title>
    <link>https://nalar.dev/tags/algorithms/</link>
    <description>Recent content in Algorithms on Nalar</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 02 Sep 2026 00:00:00 +0700</lastBuildDate>
    <atom:link href="https://nalar.dev/tags/algorithms/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Maintain Sorted Sequences in Python with bisect</title>
      <link>https://nalar.dev/maintain-sorted-sequences-in-python-with-bisect/</link>
      <pubDate>Wed, 02 Sep 2026 00:00:00 +0700</pubDate>
      <guid>https://nalar.dev/maintain-sorted-sequences-in-python-with-bisect/</guid>
      <description>&lt;p&gt;A sorted list is useful when a program needs ordered iteration and frequent searches but does not require the repeated minimum extraction of a priority queue. Python&amp;rsquo;s &lt;code&gt;bisect&lt;/code&gt; module provides binary-search operations for this exact representation.&lt;/p&gt;&#xA;&lt;p&gt;The module does not create a special container. It works with an existing sorted sequence and finds the position where a value belongs. That makes it small and predictable, but it also means the caller is responsible for preserving sorted order and understanding that inserting into a Python list still requires moving elements.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Practical Priority Queues in Python with heapq</title>
      <link>https://nalar.dev/practical-priority-queues-in-python-with-heapq/</link>
      <pubDate>Wed, 02 Sep 2026 00:00:00 +0700</pubDate>
      <guid>https://nalar.dev/practical-priority-queues-in-python-with-heapq/</guid>
      <description>&lt;p&gt;Many programs need to repeatedly choose the most important pending item rather than process items in insertion order. Schedulers pick the next deadline, graph algorithms choose the lowest-cost candidate, and streaming systems keep only the best few observations seen so far.&lt;/p&gt;&#xA;&lt;p&gt;A sorted list can solve these problems, but maintaining full ordering is often unnecessary. Python&amp;rsquo;s &lt;code&gt;heapq&lt;/code&gt; module provides a heap: a compact data structure that keeps one extreme element immediately available while doing only enough work to preserve that property.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Practical Queues and Sliding Windows with Python deque</title>
      <link>https://nalar.dev/practical-queues-and-sliding-windows-with-python-deque/</link>
      <pubDate>Wed, 02 Sep 2026 00:00:00 +0700</pubDate>
      <guid>https://nalar.dev/practical-queues-and-sliding-windows-with-python-deque/</guid>
      <description>&lt;p&gt;Many programs need a sequence that changes at both ends. A worker may append new jobs on the right and consume the oldest job from the left. A monitoring loop may keep only the most recent measurements. An algorithm may need to add or remove candidates from either side while scanning an input stream.&lt;/p&gt;&#xA;&lt;p&gt;A Python &lt;code&gt;list&lt;/code&gt; is excellent when random access and operations near the right end dominate. It is a poor fit for a FIFO queue that repeatedly removes index zero, because the remaining list elements must be shifted. The &lt;code&gt;collections.deque&lt;/code&gt; type is designed for efficient appends and pops at both ends.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
