<?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 Shobhit Nautiyal on Medium]]></title>
        <description><![CDATA[Stories by Shobhit Nautiyal on Medium]]></description>
        <link>https://medium.com/@shobhit.nautiyal99?source=rss-204137513e78------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*BCINa5PO0aSgVZzR</url>
            <title>Stories by Shobhit Nautiyal on Medium</title>
            <link>https://medium.com/@shobhit.nautiyal99?source=rss-204137513e78------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 19 May 2026 07:17:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shobhit.nautiyal99/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[Linear Search vs Binary Search]]></title>
            <link>https://medium.com/@shobhit.nautiyal99/linear-search-vs-binary-search-71b508034162?source=rss-204137513e78------2</link>
            <guid isPermaLink="false">https://medium.com/p/71b508034162</guid>
            <category><![CDATA[competitive-programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[cpp]]></category>
            <category><![CDATA[searching-algorithm]]></category>
            <dc:creator><![CDATA[Shobhit Nautiyal]]></dc:creator>
            <pubDate>Wed, 21 Dec 2022 18:48:28 GMT</pubDate>
            <atom:updated>2022-12-21T18:48:28.063Z</atom:updated>
            <content:encoded><![CDATA[<p>Linear Search and Binary Search are two popular searching algorithms. In this article, we’ll be comparing the two algorithms in order to find out which algorithm is better based on their applications.</p><h3>Linear Search</h3><p>A linear search or sequential search is a method for finding an element within a list. It sequentially checks each element of the list untill a match is found or the whole list has been searched.</p><pre>int main(){<br>    int arr[10] = {7, 14, 22, 12, 4, 19, 13, 20, 21, 11};<br>    int i, key = 13, flag = 0;<br>    for(i=0; i&lt;10; i++){<br>        if(arr[i]==key){<br>            cout&lt;&lt;&quot;Element found at: &quot;&lt;&lt;i&lt;&lt;endl;<br>            flag = 1;<br>            break;<br>        }<br>    }<br>    if(flag==0){<br>        cout&lt;&lt;&quot;Element not found.&quot;&lt;&lt;endl;<br>    }<br>    return 0;<br>}</pre><p>In above code, there is an array of 10 and we have to find 13 element in this array. The pointer is initially at at 7, and it will gradually increases and checks whether 13 is present or not.</p><pre>Element found at: 6</pre><h4>Time and Space Complexity</h4><p>In Linear Search, the best case is that we find element at index 0, so the T.C is O(1) and the average and worst cases are O(n).</p><p>The Space Complexity of linear search is O(1).</p><h3>Binary Search</h3><p>Binary Search, also known half-interval search, logrithmic search, or binary chop, is a search based algorithm that finds the position of a target value within a <em>sorted array</em>. Binary Search compares the target value to the middle element of the array.</p><pre>int binarySearch(int arr[], int low, int high, int key)<br>{<br>    while (low &lt;= high)<br>    {<br>        int mid = (low + high) / 2;<br>        if (key == arr[mid])<br>        {<br>            return mid;<br>        }<br>        else if (key &lt; arr[mid])<br>        {<br>            return binarySearch(arr, low, mid - 1, key);<br>            // high = mid - 1<br>        }<br>        else<br>            return binarySearch(arr, mid + 1, high, key);<br>        // low = mid + 1<br>    }<br>    return -1;<br>}</pre><p>The above code, is the algorithm of binary search. All the elements of the array don’t have to be visited as the array gets divided in half its size at each step until only one element is left.</p><h4>Time and Space Complexity</h4><p>In Binary Search, the best case is that we find the element in middle of an array, so the T.C is O(1) and the average and worst cases are O(log2n).</p><blockquote>In step 1 — length of array = n</blockquote><blockquote>In step 2 — length of array = n/2</blockquote><blockquote>In step 3 — length of array = n/4</blockquote><blockquote>In step 4 — length of array = n/16</blockquote><blockquote>and so on…..(k times) where k being a natural number.</blockquote><blockquote>Until, length of array = 1</blockquote><blockquote>Solving n/2^k = 1, we get-</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g1OMt77WUBpHmwJXLB4fsA.gif" /></figure><p>The Space Complexity of linear search is O(1).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71b508034162" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Function in C++?]]></title>
            <link>https://medium.com/@shobhit.nautiyal99/what-is-function-in-c-24a7cef6e85c?source=rss-204137513e78------2</link>
            <guid isPermaLink="false">https://medium.com/p/24a7cef6e85c</guid>
            <category><![CDATA[cpp]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[competitive-programming]]></category>
            <category><![CDATA[function]]></category>
            <dc:creator><![CDATA[Shobhit Nautiyal]]></dc:creator>
            <pubDate>Wed, 21 Dec 2022 18:04:33 GMT</pubDate>
            <atom:updated>2022-12-21T18:04:33.151Z</atom:updated>
            <content:encoded><![CDATA[<p>A <em>Function</em> is a piece of code that performs some operation. By using the Functions, we can save both the programmer’s time and system’s memory. With the help of Function, we can use the same code again and again. In order to create a Function, we need to give a particular name to the Function and write some logic inside it. And then we can invoke that Function from the main function.</p><p><em>Functions are used to minimize the repetition of code.</em></p><h3>Types of Functions</h3><blockquote>Pre-defined Functions</blockquote><blockquote>User-defined Functions</blockquote><h4>Pre-defined Functions</h4><p>These Functions are pre-defined in the compiler and does not need to be created by the programmer. These are those Functions that we already get to use directly, for example: cout, cin, return etc. These all are include in the header file in our source program.</p><p>Pre-defined Functions are also called <em>built-in functions</em>.</p><h4>User-defined Functions</h4><p>These Functions are made by the programmers themselves. Programmers develops on the basis of their needs. The most important thing behind these functions is the programmer can create applications with reusable code.</p><h3>Function Declaration</h3><blockquote><em>&lt;return-type&gt; &lt;function-name&gt;(&lt;list-of-parameters&gt;);</em></blockquote><h3>Function Syntax</h3><blockquote><em>&lt;return-type&gt; &lt;function-name&gt;(&lt;list-of-parameters&gt;)<br>{<br> statement 1; <br> statement 2;<br> .<br> .<br> statement n;<br>}</em></blockquote><h3>Function Call</h3><blockquote><em>&lt;function-name&gt;(&lt;arguments-list&gt;);</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24a7cef6e85c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is API?]]></title>
            <link>https://medium.com/@shobhit.nautiyal99/what-is-api-d9f456f51a02?source=rss-204137513e78------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9f456f51a02</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[web-d]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Shobhit Nautiyal]]></dc:creator>
            <pubDate>Tue, 20 Dec 2022 19:07:22 GMT</pubDate>
            <atom:updated>2022-12-21T18:08:29.864Z</atom:updated>
            <content:encoded><![CDATA[<p>API (Application Program Interface) allows programmers to communicate.</p><blockquote>APIs are the intermediary between two programs, and allows data to be transferred.</blockquote><blockquote>APIs are very versatile and can be used on the web, databases, and OS.</blockquote><blockquote>API uses HTTP protocols to transfer data.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*mMX7oeDDeyBrpT5om-s6Ig.png" /></figure><p>API includes some of the following points…</p><blockquote>Endpoint</blockquote><blockquote>Paths</blockquote><blockquote>Parameters</blockquote><blockquote>Authentication</blockquote><h4><strong>Endpoints</strong></h4><p>Every API that interact with a external system like a server, will have an endpoint. APIs works on the <em>‘requests’</em> and <em>‘responses’</em> , so whenever API requests from a web server, it will receive a response (202, 404 etc). Or endpoints are the back and fourth communication between the networks which are connected through a computing device.</p><h4><strong>Path</strong></h4><p>Path parameters are variable parts of a URL path. They are typically used to point to a specific resource within a collection, such as a user identifier by ID. A url can have several path params, each denoted with curly brackets {}.</p><h4><strong>Parameter</strong></h4><p>API params are the variable parts of a resource. Any resouce that is potentially variable requires a parameter. For example, when we design an e-commerce website and we need itemCostparam, a shippingCostparam.</p><h4><strong>Authentication</strong></h4><p>The process of certifying the identity of users trying to access resources on the servers. Authentication is when an entity verifies the identity of a user. In other words, it proves that the clients trying to access a remote server are really who they say they are.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9f456f51a02" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>