<?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 Ishita Jaju on Medium]]></title>
        <description><![CDATA[Stories by Ishita Jaju on Medium]]></description>
        <link>https://medium.com/@thejajuparadigm?source=rss-602b0f7c56be------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*rXxTN-G19XhP30_qQJl4GA.jpeg</url>
            <title>Stories by Ishita Jaju on Medium</title>
            <link>https://medium.com/@thejajuparadigm?source=rss-602b0f7c56be------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 20:58:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@thejajuparadigm/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[A Binary Search algorithm based on feedback: Optimizing the minimum satisfying value search]]></title>
            <link>https://medium.com/@thejajuparadigm/a-binary-search-algorithm-based-on-feedback-optimizing-the-minimum-satisfying-value-search-5387a3752f38?source=rss-602b0f7c56be------2</link>
            <guid isPermaLink="false">https://medium.com/p/5387a3752f38</guid>
            <category><![CDATA[optimization-techniques]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[optimization-algorithms]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[binary-search]]></category>
            <dc:creator><![CDATA[Ishita Jaju]]></dc:creator>
            <pubDate>Fri, 11 Sep 2020 08:40:37 GMT</pubDate>
            <atom:updated>2021-04-20T07:26:01.623Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a binary search algorithm for when the final element to be found isn’t yet known, but is based on the feedback of some test or function. This is an optimization to the minimum satisfying value search.</p><p>For example, to obtain the minimum satisfying value from a sorted list:<br>take list [-1, 0, 1, 2, 3, 4, 5, 6] from which the values 2, 3, 4, 5, 6 work but -1, 0, 1 do not satisfy the given condition. So, we need 2 as our answer, as 2 is the <strong><em>minimum satisfying value</em></strong>.</p><p>This algorithm is kind of an optimization for when multiple programs or tests are involved. Say you have a list of possible values from which you need the <strong><em>minimum satisfying value</em></strong> (as described above). To find out which value works and which doesn’t, you can only test out each of these values by putting them through (say) a function. So you feed each value to the program/test/function, obtain the feedback about whether it works or not and proceed the search accordingly.</p><p>A simplified version of this algorithm written in python:</p><pre>def binary_search_feedback(arr, low, high, x0):<br>    if high &gt;= low:<br>        mid = (high + low) # 2<br>    <br>        # The test function or program. Here, the function is based on user input &#39;y&#39; or &#39;n&#39;. This part is to be replaced by the testing module/function<br>        print(arr[mid],&quot;works?&quot;,end=&quot; &quot;)<br>        ans = input()</pre><pre>        if ans == &#39;y&#39;:     # if the value works<br>            x0 = arr[mid]<br>            x0 = binary_search_feedback(arr, low, mid-1, x0)<br>        elif ans == &#39;n&#39;:     # if the value does not work<br>            x0 = binary_search_feedback(arr, mid+1, high, x0)<br>    return x0</pre><pre>arr = [-1, 0, 1, 2, 3, 4, 5, 6]<br>print(binary_search_feedback(arr, 0, len(arr) - 1, arr[-1]))</pre><p><em>x0 is stored as the last known min satisfying value.</em></p><p>Here, the test inputs y or n are to be replaced by the test function/program which gives the satisfiability feedback.</p><blockquote><strong>Note:</strong> This algorithm only works for lists in which all values greater than the min sat value also satisfy the condition.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5387a3752f38" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>