<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Akshay Karande</title>
    <description>The latest articles on DEV Community by Akshay Karande (@akshay9136).</description>
    <link>https://dev.to/akshay9136</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3732130%2F5965822a-be0a-44e4-a3fa-af9c85722117.png</url>
      <title>DEV Community: Akshay Karande</title>
      <link>https://dev.to/akshay9136</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/akshay9136"/>
    <language>en</language>
    <item>
      <title>I've been diving deeper into #algorithms lately, and AVL Trees are a game changer for optimizing data retrieval. Sharing my notes and a breakdown of how they work for anyone looking to level up their DSA knowledge! 🚀</title>
      <dc:creator>Akshay Karande</dc:creator>
      <pubDate>Mon, 26 Jan 2026 05:58:26 +0000</pubDate>
      <link>https://dev.to/akshay9136/ive-been-diving-deeper-into-algorithms-lately-and-avl-trees-are-a-game-changer-for-optimizing-1fie</link>
      <guid>https://dev.to/akshay9136/ive-been-diving-deeper-into-algorithms-lately-and-avl-trees-are-a-game-changer-for-optimizing-1fie</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/akshay9136" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3732130%2F5965822a-be0a-44e4-a3fa-af9c85722117.png" alt="akshay9136"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/akshay9136/avl-trees-8ag" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Introduction to AVL Trees&lt;/h2&gt;
      &lt;h3&gt;Akshay Karande ・ Jan 26&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#datastructures&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#algorithms&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#computerscience&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#learning&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>datastructures</category>
      <category>algorithms</category>
      <category>computerscience</category>
      <category>learning</category>
    </item>
    <item>
      <title>Introduction to AVL Trees</title>
      <dc:creator>Akshay Karande</dc:creator>
      <pubDate>Mon, 26 Jan 2026 05:26:26 +0000</pubDate>
      <link>https://dev.to/akshay9136/avl-trees-8ag</link>
      <guid>https://dev.to/akshay9136/avl-trees-8ag</guid>
      <description>&lt;p&gt;Binary Search Trees are elegant, but their performance depends entirely on shape. In the worst case, a BST degrades into a linked list, turning logarithmic operations into linear ones.&lt;/p&gt;

&lt;p&gt;AVL trees were one of the earliest solutions to this problem, introducing &lt;em&gt;strict self-balancing&lt;/em&gt; to guarantee consistent performance.&lt;/p&gt;

&lt;p&gt;This article focuses on how AVL trees maintain balance and why that design choice matters, assuming you already know basic BST concepts.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is an AVL Tree?
&lt;/h2&gt;

&lt;p&gt;An AVL tree is a &lt;strong&gt;self-balancing&lt;/strong&gt; Binary Search Tree where the height difference between the left and right subtrees of every node is tightly controlled.&lt;/p&gt;

&lt;p&gt;For each node, a &lt;strong&gt;balance factor&lt;/strong&gt; is defined as:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;balance factor = height(left subtree) - height(right subtree)&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;balance factor ∈ { -1, 0, +1 }&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As long as this condition holds, the height of the tree remains &lt;code&gt;O(log n)&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  How AVL Tree Restore Balance
&lt;/h2&gt;

&lt;p&gt;AVL trees rely on &lt;strong&gt;rotations&lt;/strong&gt; to restore balance after updates. A rotation is a local restructuring that preserves BST ordering while reducing height imbalance.&lt;/p&gt;

&lt;p&gt;There are four canonical imbalance scenarios.&lt;/p&gt;




&lt;h3&gt;
  
  
  Left-Left (LL) Case
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Insertion occurs in the left subtree of the left child&lt;/li&gt;
&lt;li&gt;Fixed using a &lt;strong&gt;single right rotation&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Right-Right (RR) Case
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Insertion occurs in the right subtree of the right child&lt;/li&gt;
&lt;li&gt;Fixed using a &lt;strong&gt;single left rotation&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Left-Right (LR) Case
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Insertion occurs in the right subtree of the left child&lt;/li&gt;
&lt;li&gt;Fixed using:

&lt;ol&gt;
&lt;li&gt;Left rotation on the left child&lt;/li&gt;
&lt;li&gt;Right rotation on the unbalanced node&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Right-Left (RL) Case
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Insertion occurs in the left subtree of the right child&lt;/li&gt;
&lt;li&gt;Fixed using:

&lt;ol&gt;
&lt;li&gt;Right rotation on the right child&lt;/li&gt;
&lt;li&gt;Left rotation on the unbalanced node&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Insertion in an AVL Tree
&lt;/h2&gt;

&lt;p&gt;Insertion starts exactly like a normal BST insertion. The difference appears during recursion unwinding:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Insert the node using BST rules&lt;/li&gt;
&lt;li&gt;Update heights on the path back&lt;/li&gt;
&lt;li&gt;Compute balance factors&lt;/li&gt;
&lt;li&gt;Perform rotations when balance is violated&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Only the first unbalanced ancestor needs correction; the rest of the tree automatically stabilizes.&lt;/p&gt;




&lt;h2&gt;
  
  
  Deletion in an AVL Tree
&lt;/h2&gt;

&lt;p&gt;Deletion is more complex than insertion. Removing a node may reduce subtree height, which can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Trigger imbalance&lt;/li&gt;
&lt;li&gt;Propagate imbalance upward&lt;/li&gt;
&lt;li&gt;Require multiple rotations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The overall flow remains:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;BST deletion → height update → rebalance&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  AVL Trees vs Red-Black Trees
&lt;/h2&gt;

&lt;p&gt;A practical comparison:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;AVL Trees&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stricter balance&lt;/li&gt;
&lt;li&gt;Faster lookups&lt;/li&gt;
&lt;li&gt;More rotations during updates&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Red-Black Trees&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Looser balance&lt;/li&gt;
&lt;li&gt;Slightly slower lookups&lt;/li&gt;
&lt;li&gt;Faster inserts and deletes&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;This tradeoff explains why AVL trees are often used in &lt;strong&gt;read-heavy systems&lt;/strong&gt;, while Red-Black trees dominate standard libraries.&lt;/p&gt;




&lt;h2&gt;
  
  
  Visualizing AVL Trees
&lt;/h2&gt;

&lt;p&gt;Rotations are easier to understand visually than algebraically. If you prefer &lt;strong&gt;step-by-step&lt;/strong&gt; visual explanations, explore AVL tree animation on:&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://see-algorithms.com/data-structures/AVL" rel="noopener noreferrer"&gt;https://see-algorithms.com/data-structures/AVL&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The focus there is on &lt;em&gt;structural change&lt;/em&gt;, not just value movement, which closely matches how AVL balancing actually works.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;AVL trees represent a disciplined and predictable approach to balancing. They are not always the fastest to update, but they excel at guaranteeing performance bounds.&lt;/p&gt;




</description>
      <category>datastructures</category>
      <category>algorithms</category>
      <category>computerscience</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
