<?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 shreeji _ on Medium]]></title>
        <description><![CDATA[Stories by shreeji _ on Medium]]></description>
        <link>https://medium.com/@shreeji?source=rss-41b453f88083------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*rOZajTwgEoIpnGWr.jpg</url>
            <title>Stories by shreeji _ on Medium</title>
            <link>https://medium.com/@shreeji?source=rss-41b453f88083------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 07:25:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shreeji/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[Heaps Data Structure]]></title>
            <link>https://shreeji.medium.com/heaps-data-structure-871e88153204?source=rss-41b453f88083------2</link>
            <guid isPermaLink="false">https://medium.com/p/871e88153204</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[heap]]></category>
            <category><![CDATA[data-structures]]></category>
            <dc:creator><![CDATA[shreeji _]]></dc:creator>
            <pubDate>Fri, 20 Nov 2020 13:23:44 GMT</pubDate>
            <atom:updated>2020-11-21T11:33:41.174Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>What is Heap?</strong></h3><p>Heap is a binary tree-based data structure but with two conditions.</p><ol><li>It should be a complete binary tree.</li><li>All the nodes of the tree should follow a specific order.</li></ol><p>The ordering can be of 2 types:</p><ol><li><strong>Max-Heap: </strong>In this type of heap, the value of the parent node is greater than or equal to the value of its child nodes. The greatest value is at the root. The same property must be true for all subtrees.</li><li><strong>Min-Heap</strong>: In this type of heap, the value of the parent node is smaller than or equal to the value of its child nodes. The smallest value is at the root. The same property must be true for all subtrees.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*hLuOzweqg8rrz6NKdkjqmQ.png" /></figure><p><em>Note: Heaps don’t need to be sorted in ascending or descending order.</em></p><h3><strong>Implementation of Heap:</strong></h3><p>Let’s try to understand the construction of a Max-Heap.</p><p>To <strong>insert </strong>a node in a Max-Heap, we will follow 4 simple steps:</p><ol><li>Create an empty node at the end of the heap.</li><li>Insert the value in the newly created node.</li><li>Look at the parent node. If the value of the parent node is less than this child node, simply swap them.</li><li>Repeat the above step until Heap property holds.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*kG1sYYeGrqYyE_Wo5nEKNw.gif" /></figure><p>Now, we are going to take an unsorted array and convert it into a Max-Heap. To do this we will implement a function (max_heapify here) that can maintain the property of max heap.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*Z6rfmak8lnStzM9Uqwb8tg.png" /></figure><h3>Deletion</h3><ul><li>Removing the largest element</li></ul><p>Because Max-Heap has the largest element at the root node, we know exactly where it is in our array.</p><p>If we want to delete the element, we must shift the entire tree upwards to fill the root node’s place. To do this, again we’ll follow 4 simple steps:</p><ol><li>Delete the root node.</li><li>Take the last node of the last level directly to the top, replacing the deleted node.</li><li>Compare the new root to its children. If it is smaller than either child, swap the node with the smaller of the two children.</li><li>Repeat the above step until Heap property holds.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*pqkMEA46pS4HuiBy3nqMfg.gif" /></figure><p>Here are the functions which are deleting the root node (delete_root) and maintaining the Max_Heap property (max_heapify).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*LjJYwHWXnV3r_BVpfB70OQ.png" /></figure><p>Similarly, we can insert or delete nodes in Min-Heap as well but then we’ll go for the smallest values instead of the largest ones.</p><h3>Time Complexity:</h3><p>For<strong> Insertion</strong>:</p><p>Complexity of adding a node is: <strong>O(1)</strong></p><p>Let’s consider a Complete Binary tree of height H and N nodes, so complexity of swapping the nodes(upheapify) is: <strong>O(H) = O(log N)</strong></p><p><strong><em>Total complexity :</em></strong><em> </em><strong><em>O(1) + O(logN) =</em> <em>O(logN)</em></strong></p><p>For<strong> Deletion</strong>:</p><p>Complexity of swapping leaf node with parent node is: <strong>O(1)</strong></p><p>Let’s consider a Complete Binary tree of of height H and N nodes, so complexity of swapping the nodes(downheapify)is : <strong>O(H) = O(log N)</strong></p><p><strong><em>Total complexity :</em></strong><em> </em><strong><em>O(1) + O(logN) =</em> <em>O(logN)</em></strong></p><h3>Priority Queue in C++</h3><p>Since we have got our basics cleared and know how to build a heap, we can now easily use the built-in priority queue in C++.</p><p>Whenever elements are pushed or popped, the heap structure is maintained according to the priority queue declaration.</p><p>Check out <a href="https://www.cplusplus.com/reference/queue/priority_queue/priority_queue/">this link</a> to read about priority queue in detail.</p><h3>heapq in Python</h3><p>Similar to the priority queue, we have a heapq module in Python that we can use to build a min-heap quickly. Whenever elements are pushed or popped, the heap structure is maintained.</p><p>If you want to implement a max heap with heapq, enter your values as negative values and when you want to pop values from your max heap, change the sign of the popped value back to positive.</p><p>Check out the <a href="https://docs.python.org/3.7/library/heapq.html">Python docs on heapq</a> to expand your knowledge.</p><p>Thanks for reading and for any queries connect with me through <a href="https://www.linkedin.com/in/shreeji-265390186/">LinkedIn</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=871e88153204" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Codechef — Let’s begin!]]></title>
            <link>https://shreeji.medium.com/codechef-lets-begin-904e6b44c6f9?source=rss-41b453f88083------2</link>
            <guid isPermaLink="false">https://medium.com/p/904e6b44c6f9</guid>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[codechef]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[shreeji _]]></dc:creator>
            <pubDate>Thu, 03 Sep 2020 10:23:34 GMT</pubDate>
            <atom:updated>2020-09-03T10:23:34.022Z</atom:updated>
            <content:encoded><![CDATA[<h3>Codechef — Let’s begin!</h3><blockquote><strong>You don’t have to be great to start, but you have to start to be great. — </strong><em>Zig Ziglar</em></blockquote><p>First of all, well-wishings on choosing this road.</p><p>The competitive coding journey is entirely thrilling where you wait for 5–10 seconds with your fingers crossed to get your solution accepted, where you scratch your head on a single problem for hours, where you eventually start resenting the phrases like Time Limit Exceeded(TLE) and Runtime Error and where the green ticks or a small word “accepted” gives you immense pleasure.</p><p>But now the question arises, from where and how to start?</p><p>Coming to the first question, in my opinion, Codechef is a perfect platform for a novice. You can always explore other available platforms like Hackerrank, Leetcode, Codeforces, etc. but here I am penning down about Codechef because it is what I prefer.</p><p>Now to resolve the next and fundamental question, let’s plunge into the Codechef itself.</p><p>Codechef has an extensive range of practice problems, sorted by complexity level —<strong> <em>beginners, easy, medium, hard, challenge, peer</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*71eoG6GigL4y9km19hdxuQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*qD_XBjmR5eY_ganj6s70Sw.png" /></figure><p>They are all beginner competitive programming (CP) problems and don’t require any prerequisites except a programming language. It would be best if you spend your initial weeks in doing beginner and easy level problems. If you get stuck with the problems then don’t panic, just relax! Codechef has a solution for this too. It provides a fantastic feature where you can see all the submissions of that particular problem. Isn’t this great?</p><p>But I would not recommend you to jump to the solution directly. First, play with the problem to an extent and even then if you couldn’t come up with the correct answer, then go for the solution.</p><p>One small advice, try to think of all possible test cases and submit a correct code at once instead of correcting your code after multiple submissions. Believe me; this habit would be a blessing during the contests.</p><blockquote><strong>“The best error message is the one that never shows up.” — T</strong><em>homas Fuchs</em></blockquote><p>Another excellent feature is the contests. One perfect way to improve speed and proficiency is to participate regularly in contests. Codechef conducts <strong><em>three official contests every month</em></strong>:</p><ol><li>The Long (10 days contest).</li><li>Cook-Off (2.5 hours contest).</li><li>Lunchtime (3 hours contest).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*XAKYA9PqC_0ZEKea0UcXWA.png" /></figure><p>In the beginning, you may find it a little complicated but don’t give up, even if you were able to solve only a single problem. Have patience!</p><p>Once the contest gets over, you should always try to solve the problem either by reading editorials or watching youtube videos (AKA up-solving).</p><p>But refer editorials or videos only for logic or the approach to implement and then try to write the code on your own at last. It is instrumental in getting gradually better at contests. You can also have a look at other’s code, but most of the times, it is not very readable, and you end up being frustrated.</p><p>Continue with the same approach,<strong> “Give contests, upsolve, soak, repeat”.</strong></p><p>If your rating starts decreasing then just don’t worry, it’s very normal. Try to give more time and work on as many different types of problems as possible. Moreover, if you think that your particular topic is weak, then you can solve that topic related questions by using “search problems by tag” feature of Codechef.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*Y1SEmTfvFKs2Kj_DUiJAeA.png" /></figure><p>One more advice, try to do CP along with your friend, it not only maintains a healthy competition between you two but also motivates you to bring out the best version of yourself.</p><p>Happy coding, happy learning!</p><p>PS: I’m not promoting Codechef, I just wrote what I felt and dealt with.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=904e6b44c6f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I am Remarkable]]></title>
            <link>https://shreeji.medium.com/i-am-remarkable-246d563108d4?source=rss-41b453f88083------2</link>
            <guid isPermaLink="false">https://medium.com/p/246d563108d4</guid>
            <category><![CDATA[google]]></category>
            <category><![CDATA[i-am-remarkable]]></category>
            <category><![CDATA[women-in-tech]]></category>
            <dc:creator><![CDATA[shreeji _]]></dc:creator>
            <pubDate>Wed, 17 Jun 2020 17:39:16 GMT</pubDate>
            <atom:updated>2020-06-17T17:51:53.079Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey, I am writing down to share my today’s experience of Women Techmakers Engineering Fellows(WTEF) kickoff and IamRemarkable sessions held by Google team.</p><p>So the day started with kickoff event where we got the opportunity to listen to the stories and experiences of wonderful Googlers(Sujata Kosalge, Sunita Verma, Anil Bhansali, Heena Raval, Santanu Paul, Anuradha Paul). Their stories were very inspiring, which geared us entirely. They also answered our questions which cleared the cloud of doubts in our head.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*6Tg56-dVE8VjNrI8Vbu3aw.jpeg" /></figure><p>Coming to the IamRemarkable session, in which we all were divided into the groups of 15 people with our mentors. As a warm-up exercise, we all introduced ourselves. Then our mentor, Harleen Kaur, emphasized on various topics like imposter syndrome, self-promotion, confidence, etc.</p><p>She also discussed with us that women try to learn all the required skill sets before enrolling in any competition or job but on the other side, if men have the 60% of the required skills, they confidently apply for it and learn the rest in the meantime. So this is one essential thing we should learn from men. But after discussing it with my male-friends, we came on the conclusion that it’s more dependent on the amount of exposure one had in his/her past rather than making it gender-specific because they shared that at their first attempt they also felt a little resistant towards that.</p><p>The biggest key takeaway for me from this wonderful virtual session is to understand that how important it is to realize our accomplishments, whether be it small or big and saying about it confidently in public is not bragging or flaunting.</p><blockquote><strong>“If it’s based on facts, then it’s not bragging, and moreover accomplishments don’t speak for themselves.”</strong></blockquote><p>The session ended with an exercise in which we all were asked to write our accomplishments on both personal and professional basis, and that is where I realized how important it is to consider the achievements as it not only gives a feeling of self-happiness and contentment but also motivates me to accomplish more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*qNkoH_MtZt-AjadouUZYqQ.jpeg" /></figure><p>Last but not the least, I would like to thank my sister, my mentor Sejal Chandra for always motivating me to pen down my experiences and share the ideas so that we all can learn as a community.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=246d563108d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>