<?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 Apoorv Dixit on Medium]]></title>
        <description><![CDATA[Stories by Apoorv Dixit on Medium]]></description>
        <link>https://medium.com/@apoorvdixit619?source=rss-f72fff7183d0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*grkayfWnZqKKtI-i.jpg</url>
            <title>Stories by Apoorv Dixit on Medium</title>
            <link>https://medium.com/@apoorvdixit619?source=rss-f72fff7183d0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 23:18:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@apoorvdixit619/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[RSA Encryption Algorithm]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://apoorvdixit619.medium.com/rsa-encryption-algorithm-75d2c0e22c42?source=rss-f72fff7183d0------2"><img src="https://cdn-images-1.medium.com/max/1800/1*allwgYdvx-l3M3lX8knX6Q.jpeg" width="1800"></a></p><p class="medium-feed-snippet">Understanding the key concepts behind RSA Encryption Algorithm and implementing it from scratch in Python3.</p><p class="medium-feed-link"><a href="https://apoorvdixit619.medium.com/rsa-encryption-algorithm-75d2c0e22c42?source=rss-f72fff7183d0------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://apoorvdixit619.medium.com/rsa-encryption-algorithm-75d2c0e22c42?source=rss-f72fff7183d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/75d2c0e22c42</guid>
            <dc:creator><![CDATA[Apoorv Dixit]]></dc:creator>
            <pubDate>Mon, 31 May 2021 10:27:42 GMT</pubDate>
            <atom:updated>2021-05-31T10:54:58.922Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Convex Hull Problem]]></title>
            <link>https://apoorvdixit619.medium.com/convex-hull-problem-3358b4cb73d4?source=rss-f72fff7183d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/3358b4cb73d4</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[recursion]]></category>
            <category><![CDATA[convex-hull]]></category>
            <category><![CDATA[divide-and-conquer]]></category>
            <dc:creator><![CDATA[Apoorv Dixit]]></dc:creator>
            <pubDate>Mon, 14 Dec 2020 10:38:25 GMT</pubDate>
            <atom:updated>2020-12-14T10:45:51.426Z</atom:updated>
            <content:encoded><![CDATA[<h4>Divide and Conquer Strategy</h4><p>In this medium article we will take a look at the convex hull problem and implement a simple divide and conquer algorithm to solve the same.</p><p>I have programmed the solution in Python 3 and developed the GUI for the same using Python’s Tkinter library.</p><h3>What is a Convex Hull?</h3><p>First things first, a polygon is called a convex polygon if the angle between any of its two adjacent edges is less than 180 degrees.</p><p>Given a <strong>set of points Q</strong>, its convex hull is a <strong>convex polygon P</strong> such that it encompasses all the points of Q. In simpler words, either the points of Q lie inside the polygon P or on the boundary of it.<br>Convex Hull Problem deals with the problem of finding convex polygon with the minimum number of edges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*qIB58pds_hiKp4xecxMp_g.jpeg" /><figcaption>Set of points Q</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*QgzJi7Ae0F4ckc8hMtt4sQ.jpeg" /><figcaption>Convex Hull P of set of Points Q</figcaption></figure><h3>Brute Force Solution</h3><p>One way to solve the problem would be to join two points at a time and then check if the other points are on the same side or not. For n points, there are n*(n-1)/2 such lines and for each line, there are remaining n-2 points which need to be checked. Thus this brute approach will take O(n³) time.</p><h3>Divide and Conquer Solution</h3><p>In the Divide and Conquer Solution, the first thing we need to do is sort the points <strong>on the basis of their X-coordinates</strong>. This should take O(n log n) time.</p><p>We will maintain a solution set where in we will store the lines of the convex hull.</p><p>After the sorting, we take the leftmost point A and the rightmost point B. <strong>These points are guaranteed to be the vertices of the convex hull</strong>. Thus we add the line AB and line BA to the solution set. Down the article I will further elaborate on why I’m <strong>explicitly adding line BA</strong> to the solution set as well.</p><p>Following this we subdivide the points into two groups — points which are to the right of AB and points which are to the left of AB. By doing so we have subdivided the problem into two sub problems.</p><p>For the points to the right of AB, we find out the point <strong>which is farthest away from the line AB</strong>. Let us call this point C.</p><p>Using point C, we further subdivide these set of points into three halves X0, X1, X2.</p><p>X1 is the set of points to the right of AC and X2 is the set of points to the right of CB. The other points in X0 are the points which are to the left of AC and CB. The set of points in X0 cannot be the part of our solution, so we don’t analyse these points any further.</p><p>Thus we have broken down the solution into set of points X1 and X2 for lines AC and CB respectively. In the solution set we replace AB by the lines AC and CB.</p><p>Thus we keep dividing the problem into smaller and smaller sub-problems until we find lines which do not have any points to the right of it. <strong>These lines are a part of our solution set.</strong></p><p>We follow a similar procedure for the points on the left of AB.</p><p>For a line AB, the direction of the line is from point A to point B. Similarly for line BA, the direction is from point B to point A instead i.e. the exact opposite. So the right side of AB is the same as the left side of BA. We use this property in the algorithm as well.</p><p>So evaluating the right side of AB followed by evaluating the <strong>left side of AB</strong> is the same as evaluating the right side of AB followed by evaluating the <strong>right side of BA</strong>. This is why I’m adding line BA to the solution set.</p><p><strong>Python Program with Tkinter module</strong></p><p>Given below is the Python 3 Program for Solving Convex Hull problem using Divide and Conquer. The GUI is made using Tkinter. Use <strong>left mouse button</strong> to plant the points on the Tkinter Window, and then click the <strong>right mouse button</strong> to get the Convex Hull. Use the <strong>Mouse Wheel button</strong> to reset the program.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c93aae8747c1754da78aa94c33ca8444/href">https://medium.com/media/c93aae8747c1754da78aa94c33ca8444/href</a></iframe><p>Here are the output screenshots of the Program.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*LyDgq-MIwGbjwRI1We5NRg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*i955WyxKPl4kKfgrjCqD2A.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3358b4cb73d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Download Kaggle Dataset directly in Google Colab]]></title>
            <link>https://apoorvdixit619.medium.com/download-kaggle-dataset-directly-in-google-colab-31f90fa16c9a?source=rss-f72fff7183d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/31f90fa16c9a</guid>
            <category><![CDATA[google-colab]]></category>
            <category><![CDATA[kaggle]]></category>
            <category><![CDATA[kaggle-api]]></category>
            <category><![CDATA[dataset]]></category>
            <dc:creator><![CDATA[Apoorv Dixit]]></dc:creator>
            <pubDate>Wed, 28 Oct 2020 20:34:23 GMT</pubDate>
            <atom:updated>2020-10-28T20:34:23.764Z</atom:updated>
            <content:encoded><![CDATA[<p>In this medium article we will take a look at how to import a kaggle dataset directly in Google Colab in such a way that all it takes is running one cell to set up the dataset</p><p>Step 1: Login to your Kaggle Account and head to “<strong>My Account</strong>” at the top right corner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9EGf1iy7A480WWvuSOsfjg.png" /><figcaption>Click on My Account</figcaption></figure><p>Step 2: Click “<strong>Create New API Token</strong>” to download the API token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5V9nbnTvkosdzIxkgriOSQ.png" /></figure><p>Step 3: This is what your API token json file looks like. Keep it handy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JDXAn141zxvgkm94fUOWhQ.png" /></figure><p>Step 4: Go to the kaggle web page of the dataset that you want to download and click “<strong>Copy API Command</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lbiaAg1N4WYG31RENqdvgA.png" /></figure><p>Step 5: Open your Google Colab Notebook and paste the following code in a cell and run it.</p><p>Needless to say, replace the API token and the API command with your own and you are ready to go! Make sure to include a command to unzip the dataset downloaded as well.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7a011471ac81f4b259657aa9d5365b08/href">https://medium.com/media/7a011471ac81f4b259657aa9d5365b08/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31f90fa16c9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Goal Stack Planning for Blocks World Problem]]></title>
            <link>https://apoorvdixit619.medium.com/goal-stack-planning-for-blocks-world-problem-41779d090f29?source=rss-f72fff7183d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/41779d090f29</guid>
            <category><![CDATA[blocks-world-problem]]></category>
            <category><![CDATA[goal-stack-planning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Apoorv Dixit]]></dc:creator>
            <pubDate>Tue, 27 Oct 2020 13:44:29 GMT</pubDate>
            <atom:updated>2022-01-30T06:20:52.932Z</atom:updated>
            <content:encoded><![CDATA[<h4>Implementing Goal Stack Planning for the given configuration of Blocks World Problem</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*kWu3vlZf3IZzZ32lImunVQ.png" /><figcaption>Blocks World Problem — Initial State and Goal State for this article</figcaption></figure><p>In this medium article, we will take look at the Blocks World Problem and implement Goal Stack Planning to solve the same.</p><h4>What is Blocks World Problem?</h4><p>This is how the problem goes — There is a table on which some blocks are placed. Some blocks may or may not be stacked on other blocks. We have a robot arm to pick up or put down the blocks. The robot arm can move only one block at a time, and no other block should be stacked on top of the block which is to be moved by the robot arm.</p><p>Our aim is to change the configuration of the blocks from the Initial State to the Goal State, both of which have been specified in the diagram above.</p><h4>What is Goal Stack Planning?</h4><p>Goal Stack Planning is one of the earliest methods in artificial intelligence in which we work<strong> backwards from the goal state to the initial state.</strong></p><p>We start at the goal state and we try fulfilling the preconditions required to achieve the initial state. These preconditions in turn have their own set of preconditions, which are required to be satisfied first. We keep solving these “goals” and “sub-goals” until we finally arrive at the Initial State. <strong>We make use of a stack to hold these goals that need to be fulfilled as well the actions that we need to perform for the same</strong>.</p><p>Apart from the “Initial State” and the “Goal State”, we maintain a <strong>“World State”</strong> configuration as well. Goal Stack uses this world state to work its way from Goal State to Initial State. World State on the other hand starts off as the Initial State and ends up being transformed into the Goal state.</p><p>At the end of this algorithm we are left with an empty stack and a set of actions which helps us navigate from the Initial State to the World State.</p><h4><strong>Representing the configurations as a list of “predicates”</strong></h4><p>Predicates can be thought of as a statement which helps us convey the information about a configuration in Blocks World.</p><p>Given below are the list of predicates as well as their intended meaning</p><ol><li>ON(A,B) : Block A is on B</li><li>ONTABLE(A) : A is on table</li><li>CLEAR(A) : Nothing is on top of A</li><li>HOLDING(A) : Arm is holding A.</li><li>ARMEMPTY : Arm is holding nothing</li></ol><p>Using these predicates, we represent the Initial State and the Goal State in our example like this:</p><p><strong>Initial State </strong>— ON(B,A) ∧ ONTABLE(A) ∧ ONTABLE(C) ∧ ONTABLE(D) ∧ CLEAR(B) ∧ CLEAR(C) ∧ CLEAR(D) ∧ ARMEMPTY</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*6KlhH5ZTeTulN2fAL852Eg.png" /><figcaption>Initial State</figcaption></figure><p><strong>Goal State</strong> — ON(C,A) ∧ ON(B,D) ∧ ONTABLE(A) ∧ ONTABLE(D) ∧ CLEAR(B) ∧ CLEAR(C) ∧ ARMEMPTY</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*088nQ8-1EVEvNh05VS_zXA.png" /><figcaption>Goal State</figcaption></figure><p>Thus a configuration can be thought of as a list of predicates describing the current scenario.</p><p><strong>“Operations” performed by the robot arm</strong></p><p>The Robot Arm can perform 4 operations:</p><ol><li>STACK(X,Y) : Stacking Block X on Block Y</li><li>UNSTACK(X,Y) : Picking up Block X which is on top of Block Y</li><li>PICKUP(X) : Picking up Block X which is on top of the table</li><li>PUTDOWN(X) : Put Block X on the table</li></ol><p>All the four operations have certain preconditions which need to be satisfied to perform the same. These preconditions are represented in the form of predicates.</p><p>The effect of these operations is represented using two lists <strong>ADD </strong>and <strong>DELETE</strong>. DELETE List contains the predicates which will cease to be true once the operation is performed. ADD List on the other hand contains the predicates which will become true once the operation is performed.</p><p>The Precondition, Add and Delete List for each operation is rather intuitive and have been listed below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r_2qFEssJdqiTnB7jops1w.jpeg" /><figcaption>Operations performed by the Robot Arm</figcaption></figure><p>For example, to perform the <strong>STACK(X,Y) </strong>operation i.e. to Stack Block X on top of Block Y, No other block should be on top of Y <strong>(CLEAR(Y))</strong> and the Robot Arm should be holding the Block X (<strong>HOLDING(X)</strong>).</p><p>Once the operation is performed, these predicates will cease to be true, thus they are included in <strong>DELETE List</strong> as well. (Note : It is not necessary for the Precondition and DELETE List to be the exact same).</p><p>On the other hand, once the operation is performed, The robot arm will be free (<strong>ARMEMPTY</strong>) and the block X will be on top of Y (<strong>ON(X,Y)</strong>).</p><p>The other 3 Operators follow similar logic, and this part is the cornerstone of Goal Stack Planning.</p><h4><strong>Python3 Code for Goal Stack Planning</strong></h4><p>We can think of Predicates and Operations as objects which we need to push and pop off the Stack of our Goal Stack Planner. Keeping this in mind, we start off by creating a class for each predicate and each operation.</p><p>In the classes for operators I have included the methods to return the Predicates of Prerequisite, Add and Delete list.</p><p>On the other hand, in the classes for Predicates I have included get_action method which returns the Operator required to fulfill the unsatisfied Predicate.</p><p>I’ve included an example of a Predicate <strong>(ON(X,Y))</strong> and an Operation.<strong>(STACK(X,Y)) </strong>below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2dc482c2ed06766b93e100b62cd7ecba/href">https://medium.com/media/2dc482c2ed06766b93e100b62cd7ecba/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f364997209643fd5b22c124c0074eb06/href">https://medium.com/media/f364997209643fd5b22c124c0074eb06/href</a></iframe><p>Following this, I have a class GoalStackPlanner which takes in the initial state and the goal state as it’s parameters. It returns the steps which need to be carried out to convert initial state to goal state.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b29aa3d6dd6e319028ec6ad95d1c6fdd/href">https://medium.com/media/b29aa3d6dd6e319028ec6ad95d1c6fdd/href</a></iframe><p>Now that we have defined the necessary Classes, Here is an example for running our Goal Stack Planner</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cf749a518e46da0d252352edfb0303da/href">https://medium.com/media/cf749a518e46da0d252352edfb0303da/href</a></iframe><p>As you can see, we have stored the steps from initial state to goal state in the variable <strong>steps.</strong></p><p>In this example, steps = [PICKUP(C), PUTDOWN(C), UNSTACK(B,A), PUTDOWN(B), PICKUP(C), STACK(C,A), PICKUP(B), STACK(B,D)]</p><p>The visual representation of our steps variable looks like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qOG5tne2c4UMbWVpUVDurQ.png" /></figure><p>Now that we are done with the explanation of Goal Stack Planner and Blocks World, Here is the full Python Code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/010f843f94c1eefbdad452b125377cde/href">https://medium.com/media/010f843f94c1eefbdad452b125377cde/href</a></iframe><p>This is my first article on medium and it was a bit of a spur-of-the-moment decision. Nevertheless, I had a good time writing this article and hopefully you, the reader, has gained something out of it as well.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41779d090f29" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>