<?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 Prithivi Raj Gowdaman on Medium]]></title>
        <description><![CDATA[Stories by Prithivi Raj Gowdaman on Medium]]></description>
        <link>https://medium.com/@prithiviraj1991?source=rss-e08b453f08e6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*CPbZ-9e7CLcaUurJ.</url>
            <title>Stories by Prithivi Raj Gowdaman on Medium</title>
            <link>https://medium.com/@prithiviraj1991?source=rss-e08b453f08e6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 13:11:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@prithiviraj1991/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[How Binary Search woks?]]></title>
            <link>https://prithiviraj1991.medium.com/how-binary-search-woks-5a40e2f4064c?source=rss-e08b453f08e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a40e2f4064c</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[beginner-coding]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[binary-search]]></category>
            <category><![CDATA[beginner-javascript]]></category>
            <dc:creator><![CDATA[Prithivi Raj Gowdaman]]></dc:creator>
            <pubDate>Tue, 19 Jan 2021 06:41:50 GMT</pubDate>
            <atom:updated>2021-01-19T06:41:50.158Z</atom:updated>
            <content:encoded><![CDATA[<p>It’s a Search Algorithm that finds the position of a target value within a sorted array.</p><p>It’s same as searching the meaning for word in dictionary. If we are going to search the meaning of word “formidable”, we will directly reject the second half of the book completely. On each iteration one half of the result will be rejected.</p><p>If dictionary as 240000 words, in worst case</p><ul><li>Simple search or linear search will take maximum of same 240000 steps to find the target word.</li><li>Binary search will take only maximum of 18 steps to find the target word. “logarithm base 2” of 240000 is 18 (How many 2s do we multiply to get 240000?)</li><li>You can also think of number guessing game, you can find any number from 1 to 240000 within 18 steps.</li></ul><p>In Big O notation, linear search is O(n) and Binary Search is O(log n) — big O notation is used to measure performance of code according to how their run time or space requirements grow as the input size grows.</p><p>Higher the number of number of samples, performance difference will also be high compared to linear search.</p><p>Binary search compares the target value to the middle element of the array. If they are not equal, the half in which the target cannot lie is eliminated and the search continues on the remaining half, again taking the middle element to compare to the target value, and repeating this until the target value is found. If the search ends with the remaining half being empty, the target is not in the array.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstackblitz.com%2Fedit%2Fjs-medium-binary-search%3Fembed%3D1%26file%3Dindex.js&amp;display_name=StackBlitz&amp;url=https%3A%2F%2Fstackblitz.com%2Fedit%2Fjs-medium-binary-search%3Ffile%3Dindex.js&amp;image=https%3A%2F%2Fc.staticblitz.com%2Fassets%2Ficon-03bbb9acbba813917725387f46e5df03a95d232be240e910ce5f946a973b3f86.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=stackblitz" width="745" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/2a9a3564da068328df5f967da08d5865/href">https://medium.com/media/2a9a3564da068328df5f967da08d5865/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a40e2f4064c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>