<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Searching on Rohit Jha</title><link>https://www.rohitjha.dev/tags/searching/</link><description>Recent content in Searching on Rohit Jha</description><generator>Hugo</generator><language>en-US</language><copyright>© Rohit Jha. Articles licensed under CC BY-SA 4.0 unless noted.</copyright><lastBuildDate>Thu, 23 Jul 2026 16:53:18 +0530</lastBuildDate><atom:link href="https://www.rohitjha.dev/tags/searching/index.xml" rel="self" type="application/rss+xml"/><item><title>0x0010 - Searching Algorithms – Part 3</title><link>https://www.rohitjha.dev/blog/searching-algorithms-part-3/</link><pubDate>Fri, 18 Nov 2011 18:14:55 +0000</pubDate><guid>https://www.rohitjha.dev/blog/searching-algorithms-part-3/</guid><description>&lt;h2 id="uniform-binary-search"&gt;Uniform Binary Search&lt;/h2&gt;
&lt;p&gt;I came across the uniform binary search algorithm in &lt;em&gt;The Art Of Computer Programming – Volume 3: Sorting and Searching&lt;/em&gt; as an optimization of the &lt;a href="https://www.rohitjha.dev/blog/searching-algorithms-part-2/"&gt;binary search&lt;/a&gt;, invented by the author, &lt;a href="http://en.wikipedia.org/wiki/Donald_Knuth"&gt;Donald Knuth&lt;/a&gt;. It works quite well for architectures on which a table lookup is generally faster than an addition and a shift, and also when many searches will be performed on the same array, or on several arrays of the same length.&lt;/p&gt;</description></item><item><title>0x000f - Searching Algorithms – Part 2</title><link>https://www.rohitjha.dev/blog/searching-algorithms-part-2/</link><pubDate>Thu, 17 Nov 2011 16:10:43 +0000</pubDate><guid>https://www.rohitjha.dev/blog/searching-algorithms-part-2/</guid><description>&lt;h2 id="binary-search"&gt;Binary Search&lt;/h2&gt;
&lt;p&gt;The binary search algorithm, a variation of the &lt;a href="http://en.wikipedia.org/wiki/Dichotomic_search"&gt;Dichotomic search&lt;/a&gt;, finds the position of a specified “key” within a sorted list/array using the &lt;a href="http://en.wikipedia.org/wiki/Divide_and_conquer_algorithm"&gt;divide and conquer&lt;/a&gt; approach.&lt;/p&gt;
&lt;p&gt;At each stage, the algorithm compares the input key value with the key value of the middle element of the array. If the keys match, then a matching element has been found so its index, or position, is returned. Otherwise, if the sought key is less than the middle element’s key, then the algorithm repeats its action on the sub-array to the left of the middle element or, if the input key is greater, on the sub-array to the right. If the remaining array to be searched is reduced to zero, then the key cannot be found in the array and a special indication is returned, saying that the key was not found.&lt;/p&gt;</description></item><item><title>0x000e - Searching Algorithms – Part 1</title><link>https://www.rohitjha.dev/blog/searching-algorithms-part-1/</link><pubDate>Thu, 10 Nov 2011 08:21:00 +0000</pubDate><guid>https://www.rohitjha.dev/blog/searching-algorithms-part-1/</guid><description>&lt;p&gt;This is the first part of some searching algorithms that I’m implementing. The algorithms are:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Linear Search&lt;/li&gt;
&lt;li&gt;Binary Search&lt;/li&gt;
&lt;li&gt;Uniform Binary Search&lt;/li&gt;
&lt;li&gt;Fibonacci Search&lt;/li&gt;
&lt;li&gt;Jump Search&lt;/li&gt;
&lt;li&gt;Interpolation Search&lt;/li&gt;
&lt;li&gt;Ternary Search&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In this part, Linear Search is discussed.&lt;/p&gt;
&lt;h2 id="linear-search"&gt;Linear Search&lt;/h2&gt;
&lt;p&gt;The linear/sequential search technique is the simplest of all searching algorithms and it involves checking every element, one at a time in sequence, until the desired one is found. This type of search is easy to implement, but practical when the list has few elements or the list is unsorted. The best case is when the first element is the one to be found. The worst case is when the element is not found even after searching through the entire list. Thus, both the worst-case and expected cost is asymptotically &lt;em&gt;O(n)&lt;/em&gt;. Below are some variations of the Linear Search algorithm:&lt;/p&gt;</description></item></channel></rss>