<?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 Vikash Rahii on Medium]]></title>
        <description><![CDATA[Stories by Vikash Rahii on Medium]]></description>
        <link>https://medium.com/@vk194016?source=rss-60e1b6bcb051------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*uHJ6R7PFMbX-lE9zm97wLQ.jpeg</url>
            <title>Stories by Vikash Rahii on Medium</title>
            <link>https://medium.com/@vk194016?source=rss-60e1b6bcb051------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 03:56:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vk194016/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[Analysis Of Algorithms:]]></title>
            <link>https://medium.com/@vk194016/analysis-of-algorithms-b768a482f04a?source=rss-60e1b6bcb051------2</link>
            <guid isPermaLink="false">https://medium.com/p/b768a482f04a</guid>
            <category><![CDATA[time-complexity]]></category>
            <category><![CDATA[algorithmic-trading]]></category>
            <dc:creator><![CDATA[Vikash Rahii]]></dc:creator>
            <pubDate>Mon, 08 Jun 2020 14:59:45 GMT</pubDate>
            <atom:updated>2020-06-08T14:59:45.262Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>How to Find Which Algorithms is better?</strong></h3><p><strong>Approach-1</strong></p><p>suppose, we have a problem and there are two Algorithms to solve it then, how will decide which algorithm is best &amp; and Which Algorithm is worst to solve this problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*ks-RNmqqAtWC1o-b57AaZg.png" /></figure><p>Implement both algorithms &amp; run against some predefined test cases this test cases used by programming contest websites.</p><p>consider an example of <a href="https://www.geeksforgeeks.org/linear-search/">linear search</a> here given an array &amp; you need to find an element &amp; there is a programmer who is implemented linear search which searches element is 1st index and there is another programmer who has implemented the linear searches the last index &amp; the test cases which are there to test both the algorithm will which one is faster are designed in a way that the search element which is closer to the first index.</p><p>so, what will happened in this cases?</p><p>the 1st programmer, program will always take less time although the programmer written by the other programmer is also equally well.</p><p>the other problem of this programming contest approaches its depends upon the server load its depend upon the machine so it might be happen that when you run a program the server load is high &amp; its starts taking more time &amp; its also depends upon the machine in which you are testing your program may take less time &amp; machine in which actually run it will start taking more time.</p><p><strong>Approach-2(Asymptotic Analysis):</strong></p><p>Most of the time when we write algorithm &amp; interviewer ask these question to analyse algorithm we need to tell how good our algorithm is.</p><p>so,asymptotic analysis is theoretical approach what we do here is we major order of growth in terms of input size(n) how my algorithm time is going to grow in terms of input size is it linear or is it quadratic or is it constant .</p><p>The asymptotic behavior of a function <strong><em>f(n)</em></strong> refers to the growth of <strong><em>f(n)</em></strong> as <strong>n</strong> gets large.</p><p>We typically ignore small values of <strong>n</strong>, since we are usually interested in estimating how slow the program will be on large inputs.</p><p>A good rule of thumb is that the slower the asymptotic growth rate, the better the algorithm. Though it’s not always true.</p><p>For example, a linear algorithm <em>[Math Processing Error]f(n)=d∗n+k</em> is always asymptotically better than a quadratic one,<em>f(n)=c.n2+q</em>.</p><p>the good think about asymptotic analysis is:</p><blockquote>Asymptotic analysis its gives guarantee that if there is an algorithm which is asymptotically better there is going to be a value of n after which this algorithm will always takes less time irrespective of the computer which you are running .</blockquote><p>so that,let’s try to understand with another example:</p><p>there is an an algorithm-1 which is linear&amp; and another algorithm which is logarithmic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*5jwhDFb2s_NJeomS5zUPTw.png" /></figure><p>If we run algorithm-1 from world fastest computer &amp; also we run algorithm-2 from world slowest computer.</p><p>This Asymptotic analysis gives guarantee that there will be the value of n input size after which this world slowest computer will starts taking less time.</p><p>means logarithmic approaches take 10⁹ logn while linear algorithm takes 1/2 n.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*ohUbw03zp5TgSImGFdSiKw.png" /></figure><p>but we can see that,</p><p>10⁹logn &lt; 1/2 n</p><p>for all n ≥ n0 (we can find no by mathematical operation)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*7H1KgVkO3cr-3o6cmA33vQ.png" /></figure><p>so we just mentioned that asymptotic analysis major time taken by a program in terms of input size</p><p><strong><em>Does Asymptotic Analysis always work?</em></strong><br>Asymptotic Analysis is not perfect, but that’s the best way available for analyzing algorithms. For example, say there are two sorting algorithms that take 1000nLogn and 2nLogn time respectively on a machine. Both of these algorithms are asymptotically same (order of growth is nLogn). So, With Asymptotic Analysis, we can’t judge which one is better as we ignore constants in Asymptotic Analysis.<br>Also, in Asymptotic analysis, we always talk about input sizes larger than a constant value. It might be possible that those large inputs are never given to your software and an algorithm which is asymptotically slower, always performs better for your particular situation. So, you may end up choosing an algorithm that is Asymptotically slower but faster for your software.</p><p>References: <a href="https://www.geeksforgeeks.org/analysis-of-algorithms-set-1-asymptotic-analysis/">Click Here</a></p><p>Please write comments if you find anything incorrect.</p><blockquote><em>Thanks…</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b768a482f04a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>