<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by deaddemon on Medium]]></title>
        <description><![CDATA[Stories by deaddemon on Medium]]></description>
        <link>https://medium.com/@deaddemon?source=rss-dc5b878a098d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*54UkbMUS49HC274f</url>
            <title>Stories by deaddemon on Medium</title>
            <link>https://medium.com/@deaddemon?source=rss-dc5b878a098d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 17 May 2026 19:31:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@deaddemon/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Downgrading Nodejs version on windows]]></title>
            <link>https://medium.com/@deaddemon/downgrading-nodejs-version-on-windows-6c59a824ab34?source=rss-dc5b878a098d------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c59a824ab34</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[downgrade]]></category>
            <category><![CDATA[nvm]]></category>
            <dc:creator><![CDATA[deaddemon]]></dc:creator>
            <pubDate>Fri, 10 Mar 2023 19:27:37 GMT</pubDate>
            <atom:updated>2023-03-10T19:27:37.418Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article we will see how to downgrade the current Nodejs version which we have installed and how we can use multiple versions of Nodejs.</p><ol><li>Check you current version on terminal</li></ol><pre>node --version</pre><p>2. Install NVM , it is a Node Version Manager. In below link scroll down to</p><p><a href="https://github.com/coreybutler/nvm-windows/releases/download/1.1.10/nvm-setup.exe">nvm-setup.exe</a> to install .</p><p><a href="https://github.com/coreybutler/nvm-windows/releases">Releases · coreybutler/nvm-windows</a></p><p>You can assure the installation by checking</p><pre>nvm --version</pre><p>3. Now lets say you want to install 14.0.0 version of node. Go back to terminal and type:</p><pre>nvm install 14.0.0</pre><p>4. Type the below command to check the versions you have :</p><pre>nvm list</pre><p>The output will contain the previous version of node and the one you installed in the last step.</p><p>5. Using the step 3 you can install as many version as you want. Now to use a particular version: type: nvm use <em>version</em></p><pre>nvm use 14.0.0</pre><p>To check the current node version use node — — version , this time it will show 14.0.0.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c59a824ab34" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ways to write output of the recursive functions]]></title>
            <link>https://medium.com/@deaddemon/ways-to-write-output-of-a-recursive-functions-53dfcb1fd637?source=rss-dc5b878a098d------2</link>
            <guid isPermaLink="false">https://medium.com/p/53dfcb1fd637</guid>
            <category><![CDATA[trees]]></category>
            <category><![CDATA[recursion]]></category>
            <category><![CDATA[output]]></category>
            <category><![CDATA[cpp]]></category>
            <category><![CDATA[binary-tree]]></category>
            <dc:creator><![CDATA[deaddemon]]></dc:creator>
            <pubDate>Sat, 10 Dec 2022 18:53:17 GMT</pubDate>
            <atom:updated>2022-12-10T18:53:38.797Z</atom:updated>
            <content:encoded><![CDATA[<p>While practicing DSA, I have observed three patterns till date, when it comes to code the output of recursion that we have created in our little minds. I will be discussing one by one briefly yet clearly with the help of a question.</p><p><em>Given a Binary Tree of size </em><strong><em>N</em></strong><em>, your task is to return the sum of all the nodes of the given binary tree.</em></p><p><strong>Declare globally :</strong></p><pre>    int sum=0;<br>    int SumBST(TreeNode* root ) {<br>        <br>        if( !root ) return 0;<br>        <br>        sum += root-&gt;val;<br>        // cout&lt;&lt;sum&lt;&lt;&quot; &quot;;      <br>       <br>        SumBST(root-&gt;left);<br>        SumBST(root-&gt;right);<br>         <br>        <br>        return sum;<br>    }</pre><p>anything you want to return from the recursive function , just declare the variable globally. Here the variable is <em>sum</em>,</p><p><em>sum += root-&gt;val</em></p><p>will keep accumulating the values returned from the recursive calls.</p><p><em>SumBST(root-&gt;left );<br>SumBST(root-&gt;right );</em></p><p><strong>Modify the Function arguments:</strong></p><pre>    void dfs(TreeNode* root, int&amp; sum){<br>        if(!root) return ;<br>        sum+=root-&gt;val;<br>        dfs(root-&gt;left,sum);<br>        dfs(root-&gt;right,sum);<br>    }<br><br>    int SumBST(TreeNode* root ) {<br>        <br>        int sum =0;<br>        dfs(root,sum);<br>        return sum;<br>    }</pre><p>You must have seen this very often. Many of us modify the original function arguments, which can be hard to draw to visualize. I will suggest you to make a different function for such cases.</p><p>Here the <em>dfs</em> function have an additional argument <em>sum ,</em></p><p>which will collect all the node values</p><p><em>sum+=root-&gt;val;</em></p><p>obtained from recursive calls</p><p><em>dfs(root-&gt;left ,sum);<br>dfs(root-&gt;right, sum);</em></p><p><strong>A systematic way:</strong></p><pre><br>    int SumBST(TreeNode* root ) {<br>        <br>        if( !root ) return 0;<br>        <br>        int sum =0;<br>        sum += root-&gt;val;<br>        // cout&lt;&lt;sum&lt;&lt;&quot; &quot;;      <br>       <br>        sum += SumBST(root-&gt;left);<br>        sum += SumBST(root-&gt;right);<br>         <br>        <br>        return sum;<br>    }</pre><p>In case the Interviewer ask you to not declare the variable globally and to not to modify the arguments, you can just simply write our little variable inside the function and gather the values in <em>sum</em> using</p><p><em>sum += SumBST(root-&gt;left);<br>sum += SumBST(root-&gt;right);</em></p><p>with the base condition</p><p><em>if(root) sum += root-&gt;val;</em></p><blockquote>I hope that helps. Lemme know in comment section , If I can add something .</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53dfcb1fd637" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>