<?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: N Satyadev</title>
    <description>The latest articles on DEV Community by N Satyadev (@n_satyadev_dd94f2ee2957ba).</description>
    <link>https://dev.to/n_satyadev_dd94f2ee2957ba</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%2F3937170%2Fb39e5f36-6afd-4845-8a38-0e690dedcc3b.png</url>
      <title>DEV Community: N Satyadev</title>
      <link>https://dev.to/n_satyadev_dd94f2ee2957ba</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/n_satyadev_dd94f2ee2957ba"/>
    <language>en</language>
    <item>
      <title>Recursion Isn’t Hard. The Call Stack Is Invisible</title>
      <dc:creator>N Satyadev</dc:creator>
      <pubDate>Tue, 19 May 2026 10:23:25 +0000</pubDate>
      <link>https://dev.to/n_satyadev_dd94f2ee2957ba/recursion-isnt-hard-the-call-stack-is-invisible-1jad</link>
      <guid>https://dev.to/n_satyadev_dd94f2ee2957ba/recursion-isnt-hard-the-call-stack-is-invisible-1jad</guid>
      <description>&lt;p&gt;Ever went through a simple DFS code and went "&lt;em&gt;I would rather beat an old lady with a stick&lt;/em&gt;"?&lt;/p&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2F9mmaeqgg1grk9zym8kn6.png" class="article-body-image-wrapper"&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%2Farticles%2F9mmaeqgg1grk9zym8kn6.png" alt="A simple recursive inorder traversal code" width="358" height="150"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That was me until &lt;strong&gt;I wasn't&lt;/strong&gt;. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You know what trees are.&lt;/li&gt;
&lt;li&gt;You also know how the traversals work.&lt;/li&gt;
&lt;li&gt;Yet you seem to never truly grasp recursive tree traversals.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The problem seems much deeper than &lt;em&gt;"I suck at recursion"&lt;/em&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  The "Tutorial Hell" Phase
&lt;/h1&gt;

&lt;p&gt;Facing the problem myself, I tried many things — from getting into tutorial hell to solving problems on HackerRank, LeetCode but... does that even work? &lt;br&gt;
In my case, a clear &lt;strong&gt;NO&lt;/strong&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Breakthrough: Manual Simulation
&lt;/h1&gt;

&lt;p&gt;The solution is finding out what is actually stopping you from using trees. Play around with it, understand what a call stack is. &lt;br&gt;
Simulate recursion without using recursion &lt;em&gt;(yup, that is a thing)&lt;/em&gt; yourself by maintaining a manual call stack on a piece of paper or any programming language.&lt;/p&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2Ff9cq32671pieuzuoo8ze.png" class="article-body-image-wrapper"&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%2Farticles%2Ff9cq32671pieuzuoo8ze.png" alt="C function that tracks" width="669" height="187"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2Fhewe8gupkzy0267s32kf.png" class="article-body-image-wrapper"&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%2Farticles%2Fhewe8gupkzy0267s32kf.png" alt="A C program that implements inorder traversal while maintaining a manual call stack" width="665" height="566"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2Fe8bmwv0w6qdwtoxyo63d.jpeg" class="article-body-image-wrapper"&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%2Farticles%2Fe8bmwv0w6qdwtoxyo63d.jpeg" alt="Notes that shows maintaining manual call stack on a piece of paper" width="800" height="738"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now the conclusion is — &lt;strong&gt;you understand everything&lt;/strong&gt;, yet those 3 lines seem magical. That is probably because you are not doing the &lt;em&gt;heavy lifting&lt;/em&gt; here. &lt;br&gt;
Recursion takes care of that, and you don't see how.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Strategy: Walkthrough the problem
&lt;/h1&gt;

&lt;p&gt;The most basic fix? &lt;strong&gt;Just be a human&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;While developing one of my projects I ran into this exact issue again. What did I do? The exact thing I mentioned above. &lt;br&gt;
I Wrote down the problem, went through it step by step. Made sure I knew what I was looking for before I even touched that damn keyboard.&lt;/p&gt;

&lt;p&gt;Let us say the expression is: &lt;code&gt;a=b AND b=c&lt;/code&gt;. If someone says, "&lt;strong&gt;write code to make it a tree&lt;/strong&gt;," it might feel like they asked you to &lt;em&gt;poop gold&lt;/em&gt; which somehow seems much more reasonable. But it is really not that complex. &lt;br&gt;
The best thing to do at this point is probably ignore all the complex terminologies like &lt;strong&gt;LR&lt;/strong&gt;, &lt;strong&gt;LL&lt;/strong&gt; parsers etc which makes it intimidating. At the core it's all about converting a human thinking process into machine code.&lt;/p&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2F62qx5zgbayac8ckoif66.jpeg" class="article-body-image-wrapper"&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%2Farticles%2F62qx5zgbayac8ckoif66.jpeg" alt="Notes on how a tree can be generated out of expression" width="800" height="497"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The "&lt;strong&gt;how&lt;/strong&gt;" becomes pretty easy from here. &lt;br&gt;
You know &lt;strong&gt;AND&lt;/strong&gt; is the root, and each left and right side is again a &lt;em&gt;sub-tree&lt;/em&gt; with its operator as the root. &lt;br&gt;
The simplest approach (to understand recursion) is to manually check the sequence and advance. Each &lt;em&gt;lexeme&lt;/em&gt; is just a node with a value and left/right pointers. &lt;br&gt;
A tree is just connections of pointers and recursion is all about &lt;strong&gt;returning those pointers in a very strategic way&lt;/strong&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Once recursion starts feeling fun — congratulations, it’s over. You’re a &lt;strong&gt;nerd&lt;/strong&gt; now.&lt;/p&gt;

&lt;p&gt;If you have been trying to figure out recursion for 67th time now... take a break, touch some grass, come back and make sure you C problems in a human way before attempting to solve like a machine.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;PS&lt;/strong&gt;: Using AI tools like Gemini, Claude, or ChatGPT isn't too bad for understanding such topics either — they add to your existing understanding rather than replacing it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TLDR: Simulate before you code. Draw before you type. Be a human first, a programmer second.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>learning</category>
      <category>computerscience</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
