<?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 Aman Agarwal on Medium]]></title>
        <description><![CDATA[Stories by Aman Agarwal on Medium]]></description>
        <link>https://medium.com/@developerslens?source=rss-843ae6bb2a08------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SDNmTMxw2Go6r6wOHCHYKQ.jpeg</url>
            <title>Stories by Aman Agarwal on Medium</title>
            <link>https://medium.com/@developerslens?source=rss-843ae6bb2a08------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 08:48:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@developerslens/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[Dutch Flag Algorithm]]></title>
            <link>https://medium.com/quick-code/dutch-flag-algorithm-3669af2b14fd?source=rss-843ae6bb2a08------2</link>
            <guid isPermaLink="false">https://medium.com/p/3669af2b14fd</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[arrays]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[data-structure-algorithm]]></category>
            <dc:creator><![CDATA[Aman Agarwal]]></dc:creator>
            <pubDate>Tue, 29 Dec 2020 07:34:03 GMT</pubDate>
            <atom:updated>2021-05-23T08:29:23.494Z</atom:updated>
            <content:encoded><![CDATA[<h4>Let’s answer #3</h4><p>An introduction to the Dutch Flag Algorithm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AJhDDIN2ykUfZd5c" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Dutch Flag Algorithm (DFA) is one of the most basic and important algorithms for arrays. It is used to segregate an array consisting of 3 numbers in linear time complexity.</p><p>The worst time complexity for DFA is O(n) and the space complexity for the algorithm is O(1). The problem statement is as follows:</p><blockquote>An array consisting of 0s, 1s, and 2s is provided to you. The task is to write a function that segregates all the numbers together. The order can be anything.</blockquote><p>Let&#39;s assume that the provided array A is<br>A = [1, 2, 0, 1, 2, 0, 1, 2, 0]<br>and the output expected is<br>A = [2, 2, 2, 0, 0, 0, 1, 1, 1]</p><p>To solve the problem, we need to first select the order. For this example, let&#39;s select 2,1,0. <br>Now we need to have 3 pointers namely <strong>start, end, </strong>and <strong>P</strong>, pointing to three different indices of the array.</p><p>The <strong>start</strong> will denote the first index of the middle element i.e 0 over here. The <strong>End</strong> will denote the last index of the middle element and pointer <strong>P </strong>will be used to traverse the array.</p><p>The loop will run while the <strong>P</strong> is not equal to <strong>End. </strong>As the P traverses, if P encounters 2, it will swap it with <strong>start </strong>and increment the start. Similarly, if P encounters 1, it will swap it with end and decrement end. The code is as follows:-</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d2b32c790eb64ce35affeeb7fbd2336/href">https://medium.com/media/5d2b32c790eb64ce35affeeb7fbd2336/href</a></iframe><p>For a better understanding of the algorithm, write the stack trace on paper, and make sure you go through all the steps.</p><p>If you have any queries or you want me to cover any other algorithm, feel free to comment down the article.</p><p>Stay tuned for more such algorithms and concepts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3669af2b14fd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/quick-code/dutch-flag-algorithm-3669af2b14fd">Dutch Flag Algorithm</a> was originally published in <a href="https://medium.com/quick-code">Quick Code</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What are Arrays?]]></title>
            <link>https://medium.com/quick-code/lets-answer-what-are-arrays-3ac49a4d70e0?source=rss-843ae6bb2a08------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ac49a4d70e0</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[arrays]]></category>
            <dc:creator><![CDATA[Aman Agarwal]]></dc:creator>
            <pubDate>Thu, 24 Dec 2020 22:18:28 GMT</pubDate>
            <atom:updated>2020-12-26T15:39:31.240Z</atom:updated>
            <content:encoded><![CDATA[<h4>Lets Answer #2</h4><h4>Let&#39;s demystify Arrays.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8k7Gsbc3wLlATKje" /><figcaption>Photo by <a href="https://unsplash.com/@lucabravo?utm_source=medium&amp;utm_medium=referral">Luca Bravo</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>An array is a data structure that stores a bunch of similar typed data in a contiguous memory location. This means that the array elements can be traversed with the help of whole number indexing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*e6ViCVxN4Bpk17bs3Viiug.gif" /><figcaption>A visualization for Arrays. <em>Picture source: </em><strong><em>Oracle</em></strong>.</figcaption></figure><p>Each data type takes a particular amount of memory. Some of the values are:</p><pre>+----------------+----------------------------+<br>| <strong>Data types</strong>     |<strong> Memory Occupied(in Bit)</strong>    |<br>+----------------+----------------------------+<br>| Boolean        | 1                          |<br>| Byte           | 8                          |<br>| Char           | 16                         |<br>| Short          | 16                         |<br>| Int            | 32                         |<br>| Long           | 64                         |<br>| Float          | 32                         |<br>| Double         | 64                         |<br>+----------------+----------------------------+</pre><blockquote>In C and C++, the size of Char is 8 Bit while in Java it is 16 bit as C and C++ use ASCII format and Java uses Unicode Format.</blockquote><p><strong>Calculation of address of each element</strong></p><p>The formula for calculation of address of each element is</p><pre><strong>Address of nth element = Base Address +(n-1)*(size of data type) </strong><br>where <br>n is the element you want the address for. <br>Base address is the address of element at first element<br>and size of data type refers to memory occupied by the data type.</pre><p>When to use arrays:</p><ul><li>When the <strong>order </strong>of data matters.</li><li>When <strong>you know the number of elements </strong>and the number of <strong>elements is fixed</strong>.</li><li>And when the <strong>elements are similarly typed</strong>. An array can only hold a single data type.</li></ul><blockquote>Note: In most of the languages, the index starts from 0 but in some languages, the index starts with one. So all the limits for the loops will change accordingly.</blockquote><blockquote>Arrays are one of the most basic data structures and can be used to implement other data structures like Queue, stack, heap, etc.</blockquote><p><strong>Basic operations on Arrays</strong></p><p>Here are some of the basic operations which can be performed on arrays:</p><blockquote>In Java, the arrays are abstracted by the class called ArrayList. Using this class is beneficial as it provides various functions and helps you to write better code.</blockquote><p><strong>Traversing</strong></p><p>Traversing means printing all the elements of a data structure.</p><p><strong>Sorting</strong></p><p>There are multiple ways to sort an array. Some of the most popular ways of sorting arrays are Bubble Sort, Selection Sort, Merge Sort, Quick Sort, Radix Sort, Heap Sort, Bucket Sort, and many more. Sorting will be covered in a separate article as it is a pretty huge topic.</p><p><strong>Searching</strong></p><p>Searching if the element is present in the array. If it is present, it will return the index, or else it will return -1</p><p><strong>Reversing</strong></p><p>Reversing the order of the arrays. This means that the last element will be swapped by the first element.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0bcd5abc4f3e989de8a4b923f2828aae/href">https://medium.com/media/0bcd5abc4f3e989de8a4b923f2828aae/href</a></iframe><p>There are more operations like Insertion, Deletion, check if it is a palindrome, etc. They will be covered in subsequent articles.</p><p>Stay tuned for more articles and if in case you have missed the previous article on “Introduction to Data Structures”. Do check it out. The link to the article is <a href="https://medium.com/quick-code/what-is-data-structures-e9553f3bb949">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ac49a4d70e0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/quick-code/lets-answer-what-are-arrays-3ac49a4d70e0">What are Arrays?</a> was originally published in <a href="https://medium.com/quick-code">Quick Code</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Data Structures?]]></title>
            <link>https://medium.com/quick-code/what-is-data-structures-e9553f3bb949?source=rss-843ae6bb2a08------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9553f3bb949</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[Aman Agarwal]]></dc:creator>
            <pubDate>Sun, 20 Dec 2020 13:25:08 GMT</pubDate>
            <atom:updated>2020-12-23T19:15:43.041Z</atom:updated>
            <content:encoded><![CDATA[<h4>Let’s Answer #1</h4><h3>Let’s answer: What is a data structure?</h3><h4>Together let’s demystify Data structures</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AeLqA1Vtp7JVYt0W" /><figcaption>Photo by <a href="https://unsplash.com/@blakeconnally?utm_source=medium&amp;utm_medium=referral">Blake Connally</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>What is a data structure?</h4><p><em>In simple words</em></p><blockquote>Data structures are the ways in which you can store data inside your runtime memory for efficient usage of data.</blockquote><p>For example: Let&#39;s say you are given a list of 10 numbers and you are asked to arrange the list of 10 numbers in ascending order. The input in the format of one number each line. Below mentioned are some of the approaches.</p><pre><strong>Approach 1:</strong><br><strong>Store each number in a different integer and manually compare the values.</strong><br>This will be done in constant time complexity, if you are able to write the code because there are 3628800 or 10 factorial <em>if conditions to be coded. This is not practically possible.</em></pre><pre><strong>Approach 2:</strong><br><strong>Store the list of numbers in an array.</strong><br>This will estalish a link between all the numbers and we will be able to rearrange the numbers in ascending order. The worst time complexity could be O(n^2)and can be optimized to O(nlog n). There are various algorithm for sorting the numbers. Some of them are Bubble Sort, Seletion Sort, Merge Sort, quick Sort and many more. This is one of the most popular ways of solving the problem.</pre><pre><strong>Approach 3:</strong><br><strong>Storing the elements in a Binary Search Tree.<br></strong>Another less popular way of sorting numbers is to store the integers in a binary search tree and traverse the tree in a pre-order manner. The worst time complexity is O(n^2).</pre><h4>Why data structures are important?</h4><p>Data structures are important because it increases the</p><ul><li><strong>Efficiency</strong>: Using proper data structures will enable the programmers to write code that consumes less time and less space, thus is memory friendly.</li><li><strong>Reusability</strong>: Using standard data structures enable the developers to create libraries specific for Data Structures and thus enable the programmers to abstract the basic operations which are performed over various Data structures.</li></ul><h4>Basic operations on data structures</h4><p>There are 6 basic operations that can be performed on any data structure. They are:</p><ul><li><strong>Search</strong>: Finding an element inside the data structure.</li><li><strong>Sort</strong>: Rearranging all the elements in an ascending or descending order.</li><li><strong>Traverse</strong>: Printing all the elements in a particular manner.</li><li><strong>Insertion</strong>: Inserting an element in a data structure at any Position.</li><li><strong>Deletion</strong>: Deleting any element from the data structure.</li><li><strong>Update</strong>: Updating any element from the data structure.</li></ul><h4>Types of Data Structures</h4><p>Broadly there are two types of data structures:</p><ul><li>Linear data structures</li><li>Non-Linear data structures</li></ul><h4>Linear data structures</h4><p>Those data structures that store the data in a linear manner i.e one after another or simply in one dimensional way are called Linear data structures.</p><p>They are again of two types:</p><ul><li>Static: Data structures whose size cannot be changed once declared. Example: Array.</li><li>Dynamic: Data structures whose size can change even after the declaration. Example: Linked List.</li></ul><p><strong>Non-Linear data structures</strong></p><p>Those data structures that store the data in a multi-dimensional way are called Non-linear data structures.</p><p>They are again of 2 types:</p><ul><li>Graphs</li><li>Hash Tables</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*SCSyMwmK5pf-SiooDv-v5w.png" /><figcaption>A diagram to explain the types of Data Structures. Picture from: GeeksForGeeks.com</figcaption></figure><p>Each data structure mentioned in the article again has various subtypes.</p><p>Each data structure will be covered in-depth in a different article along with practice problems and common algorithms.</p><p>Stay tuned for more such articles and if you want articles on a particular topic, do drop me a mail.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9553f3bb949" width="1" height="1" alt=""><hr><p><a href="https://medium.com/quick-code/what-is-data-structures-e9553f3bb949">What is Data Structures?</a> was originally published in <a href="https://medium.com/quick-code">Quick Code</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Journey to start a blog]]></title>
            <link>https://developerslens.medium.com/journey-to-start-a-blog-b864b6de9bf?source=rss-843ae6bb2a08------2</link>
            <guid isPermaLink="false">https://medium.com/p/b864b6de9bf</guid>
            <category><![CDATA[journey]]></category>
            <category><![CDATA[blog]]></category>
            <category><![CDATA[medium]]></category>
            <category><![CDATA[first-post]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Aman Agarwal]]></dc:creator>
            <pubDate>Sat, 19 Dec 2020 08:49:28 GMT</pubDate>
            <atom:updated>2020-12-19T13:54:38.225Z</atom:updated>
            <content:encoded><![CDATA[<h4>The first blog on the journey of how I came to Medium</h4><h4>Hurdles faced when I was about to start blogging. A short blog on how I came to Medium and Why liked it.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-ehzowREWBU6fzxcnkaXLQ.jpeg" /></figure><p>After graduating and working in a software firm, I always wanted to set up blogs. I found out that blogging is one of the few methods through which you can express what you have learned in life. The knowledge is not restricted technical domain but expands over to the hard-learned reality of life and the course of exploring the vast number of options one is asked to choose from. No option is right or wrong, it just directs our life to a new path.</p><p>To establish a blog from the very beginning, I started to build a website. I was technically sound enough to build a developer portfolio and host it with a custom domain. But the real challenge lies ahead, how to make the blog work?</p><p>Extending the portfolio to a blog was a great task. I started by looking for the architecture of blogs that could be scaled up and require less maintenance. But managing various tasks like writing blogs, creating a blog editor for uploading blogs, storing blog in a database, using a hosted database, securing the backend of the blog, and optimizing the blog for search engines was a tough task to be done individually.</p><p>So I moved to a second option Using website builder and third-party CMS. CMS stands for the content management system. Tools like WordPress, <a href="https://medium.com/u/2741d9d88322">Wix</a>, etc provide you solutions to host your blogs at a minimal price. The major drawback I suffered was these tools were developed in languages I was not knowing. So to adapt to these tools, either I have to learn a new language and scrap my previous work or somehow make my existing work compatible with tools. Even learning these tools was difficult for me.</p><p>So I started exploring the options to use a blogging platform and I stumbled upon <a href="https://medium.com/u/504c7870fdb6">Medium</a>. Medium provided me enough space to express my experience and save me the hassle of setting up a custom blog.</p><p>I chose Medium mainly due to</p><ul><li>Clean and minimal design</li><li>Great SEO features</li><li>Great audience</li><li>APIs are available for third-party integration.</li></ul><p>I will mainly blog about learning in the technology world, which will include tricks and hacks related to Web Development, surviving in the Software industry, and dilemma software engineers face after their graduation.</p><p>Stay tuned for more amazing stories and insights into the tech industry.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b864b6de9bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>