<?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 Vishal neekhara on Medium]]></title>
        <description><![CDATA[Stories by Vishal neekhara on Medium]]></description>
        <link>https://medium.com/@vishalneekhra?source=rss-f17b110f9349------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*-WWWX6uq-vuSTOmJ</url>
            <title>Stories by Vishal neekhara on Medium</title>
            <link>https://medium.com/@vishalneekhra?source=rss-f17b110f9349------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 03:57:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vishalneekhra/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[Amortized time complexity with HashMap]]></title>
            <link>https://medium.com/@vishalneekhra/amortized-time-complexity-with-hashmap-2336f96a54ad?source=rss-f17b110f9349------2</link>
            <guid isPermaLink="false">https://medium.com/p/2336f96a54ad</guid>
            <category><![CDATA[datastrucutre]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[rehash]]></category>
            <category><![CDATA[time-complexity]]></category>
            <category><![CDATA[hashmap]]></category>
            <dc:creator><![CDATA[Vishal neekhara]]></dc:creator>
            <pubDate>Tue, 09 Jun 2020 10:30:26 GMT</pubDate>
            <atom:updated>2020-06-09T10:30:26.933Z</atom:updated>
            <content:encoded><![CDATA[<h3>Amortized time complexity HashMap</h3><p>In many data structure you won’t run out of space for example arraylist , Hashmap , hashset because there size grow as you insert elements.</p><p>Let’s talk about Hashmap.</p><p>Suppose inital size of hashmap is 10 and threshold hold value 0.5 which means whenever our hashmap is half filled we will increase the size of hashmap . when 5 element are insert then size of hashmap become 20 similarly when 10 element are insert size of hashmap become 40 and so on.</p><blockquote><em>What is meaning of increasing size</em> : In RAM there is continous memory allocation so we can’t just increase the size of hashmap , so whenever any dyanmic data structure has to increase it size it has to create new memory location and copy the old data.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*6S4agjEzwhVqEl3hoCedzg.png" /><figcaption>Img src :<a href="https://i.stack.imgur.com/UWGVy.png">https://i.stack.imgur.com/UWGVy.png</a></figcaption></figure><p>The above process is know as Re-hashing in case of hashmap.</p><p>So when new element is insert it take O(1) but if the element insert at size*threshold position then it takes O(n) because of rehashing.</p><p>Now there are two complexity in case of insertion :O(1) and O(n) but O(n) is occur only few of the element .So we consider average complexity of amortize complexity which is O(1).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2336f96a54ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>