<?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 Sagore Sarker on Medium]]></title>
        <description><![CDATA[Stories by Sagore Sarker on Medium]]></description>
        <link>https://medium.com/@sagoresarker?source=rss-10ab0f098d16------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*zCwmmgAgVP229hCujPwomQ.jpeg</url>
            <title>Stories by Sagore Sarker on Medium</title>
            <link>https://medium.com/@sagoresarker?source=rss-10ab0f098d16------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 02:48:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sagoresarker/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[Problem-Solving with Leetcode | Shuffle String | Easy 1]]></title>
            <link>https://sagoresarker.medium.com/problem-solving-with-leetcode-shuffle-string-easy-1-c2e6ee40ff43?source=rss-10ab0f098d16------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2e6ee40ff43</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[interview-preparation]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[leetcode-easy]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Sagore Sarker]]></dc:creator>
            <pubDate>Sun, 06 Mar 2022 05:46:03 GMT</pubDate>
            <atom:updated>2022-03-06T05:52:18.305Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_0qa8sWrn5pUVT5tau14lw.png" /></figure><p>Let’s talk about a LeetCode easy problem. Today we’ll discuss the Shuffle String (LeetCode number 1528).</p><p>You are given a string s and an integer array indices of the same length. The string s will be shuffled such that the character at the ith position moves to indices[i] in the shuffled string.</p><p>Return the shuffled string.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*YWb5jmW_BdBHuPLkbGhD7A.png" /><figcaption>Shuffle String | Leetcode 1528</figcaption></figure><p>From the above example, you may understand the problem. But how do we step through its solution? If you can’t understand the problem, I have a little explanation for you. As input, you have given a string, S, and its index value, indices, by the corresponding character. You have to place the character according to their corresponding index.</p><p>So, how do we solve it both in Python and Golang?</p><p>The main idea to solve the problem is, to insert the character with its corresponding index and build a string and return it. It is quite an easy task.</p><p>First, initialize a list with the length of the given string. Run a for loop to iterate over the list and insert the character to its corresponding index. Then join the list and return. Yeah, you have done it. For your help, here I share my python and Golang code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/63bb9a38581b1de5c76887ad24176a54/href">https://medium.com/media/63bb9a38581b1de5c76887ad24176a54/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/60517241a12ec943f6ff04978b1ec747/href">https://medium.com/media/60517241a12ec943f6ff04978b1ec747/href</a></iframe><p>Happy Coding :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2e6ee40ff43" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How dictionary do operation like array with O(1) complexity]]></title>
            <link>https://sagoresarker.medium.com/how-dictionary-do-operation-like-array-with-o-1-complexity-7324ec9e481b?source=rss-10ab0f098d16------2</link>
            <guid isPermaLink="false">https://medium.com/p/7324ec9e481b</guid>
            <category><![CDATA[what-is-python-dictionary]]></category>
            <category><![CDATA[hashing]]></category>
            <category><![CDATA[python-dictionaries]]></category>
            <category><![CDATA[dictionary-complexity]]></category>
            <category><![CDATA[list-vs-dictionary]]></category>
            <dc:creator><![CDATA[Sagore Sarker]]></dc:creator>
            <pubDate>Fri, 04 Feb 2022 19:33:21 GMT</pubDate>
            <atom:updated>2022-03-02T20:53:05.958Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="How dictionary do operation like array with O(1) complexity | https://sagoresarker.medium.com/" src="https://cdn-images-1.medium.com/max/1024/1*0OFZGJcWWEVkJ5aDUSViyw.png" /></figure><p>To reduce the time complexity of your program, you might use a dictionary rather than an array. Because accessing, adding, or removing any elements from a simple list required O(n) or greater than time. But the same operation can be performed by the dictionary in python with O(1) time.</p><p>When I came to know about this concept, first the question ‘Why’ came to my mind. Why dictionary is exceptional than a list data structure? If you have the same sorts of questions in your mind, you can go through this article. Otherwise, leave it.</p><p>In short, to reduce the time complexity, we can use hashmap which is implemented in the dictionary in python.</p><p>Dictionary in python is built with a hash table and uses SipHash open addressing collision resolution method, where sipHash is mainly used for hashing. It can store value in key-value pairs. When we try to access any value from a dictionary, it goes for a lookup for a specific address it stores on storage.</p><figure><img alt="Hashing" src="https://cdn-images-1.medium.com/max/600/1*ENkHkX5zuzJSy1Ka-4bh9A.png" /></figure><p>If you are new to the word Hashing, in short, I can tell you that Hashing is an encrypting process where any key is transforming into another specific fixed-size value. And they are stored separately. When more than one key is overlap with other encrypted keys, it’s called a collision. To eliminate the collision among the hashed value, python use sipHash as a hash function method and reduce the possibility to overlap any single value. After the update of Python 3.4, it changes its hashing method previous Fowler-Noll-Vo hash function to sipHash. They found some loopholes in security and performance in Fowler-Noll-Vo hash function, that’s why they changed it.</p><p>Maybe you are wondering to see hashmap or hashing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*NjZqwBTKmpJSirFlGkVLAQ.png" /></figure><p>Now, look at the main context of this article. How does Dictionary do any operation in O(1) complexity? By google definition “A HashMap is a data structure implementing a key-value pair and is used in certain languages, e.g. Java, whereas a dictionary is an equivalent data structure used in other languages such as Python, although Java also has a Dictionary type as well.”</p><p>That means, every key in the dictionary is generated by this hash function. When we try to access it, it directly goes to the specific address and processes the result. By default, the values are set as None. When any value does not exist in that dictionary, the value associated with any input key is None. That’s why it shows None message to the caller.</p><p>Here is a simple problem solution by Hashmap in python. If you look so closely, you can get the key concept of this article.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c0f3da0b1c58785dd21b6bdc233f511/href">https://medium.com/media/3c0f3da0b1c58785dd21b6bdc233f511/href</a></iframe><p>Now, why did the dictionary consider a hash function? Maybe this question came to your mind at the beginning of the article. The Dictionary data structure in python stores value in key-value pairs. The key is stored in the computer storage by encrypting it using sipHash algorithm that helps to track and find it so fast. In sort, Dictionary in python is processed through it.</p><p>Now, another question. How does the dictionary work on 0(1) order? The dictionary try to access a value by calling the key value of that data. When it tries to access the value, it already knows the encryption process and algorithm of Key encryption, and simply finds it with Bigo of O(1) time. That’s why it only takes O(1) time to access any element in the dictionary.</p><p>Reference:</p><p><a href="https://www.python.org/dev/peps/pep-0456/">PEP 456 -- Secure and interchangeable hash algorithm</a></p><p><a href="https://docs.python.org/3/tutorial/datastructures.html#dictionaries">https://docs.python.org/3/tutorial/datastructures.html#dictionaries</a></p><p><a href="https://en.wikipedia.org/wiki/SipHash">https://en.wikipedia.org/wiki/SipHash</a></p><p><a href="https://andrewbrookins.com/technology/pythons-default-hash-algorithm/#:~:text=So%2C%20there%20you%20have%20it,that%20should%20prevent%20collision%20attacks">https://andrewbrookins.com/technology/pythons-default-hash-algorithm/#:~:text=So%2C%20there%20you%20have%20it,that%20should%20prevent%20collision%20attacks</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7324ec9e481b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python Vs Golang: Performance test]]></title>
            <link>https://sagoresarker.medium.com/python-vs-golang-performance-test-a0dabb6c35ed?source=rss-10ab0f098d16------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0dabb6c35ed</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python-vs-go]]></category>
            <dc:creator><![CDATA[Sagore Sarker]]></dc:creator>
            <pubDate>Thu, 03 Feb 2022 08:29:43 GMT</pubDate>
            <atom:updated>2022-02-03T08:46:28.046Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uGwgCZizjLd_9q5ESJECfg.png" /><figcaption>Python Vs Golang: Image collected from google</figcaption></figure><p>Do you code in python or Golang? Or another language? But have a question about python vs Golang performances? Then, this article for you. I’ll show you a proven way to visualize the efficiency of these two languages.</p><p>For the most part, Python is an interpreted language and not a compiled one. On the other hand, Golang is a compiled language. If you don’t have any idea about what are compiled language and interpreted language, <a href="https://sagoresarker.medium.com/compiler-vs-interpreter-b2615c8691a3"><em>you can follow this article</em></a><em>.</em></p><p>Python is first introduced in 1991. By its age, it has a huge developer community who try to make it more efficient day to day. And Golang is first conceptualized in 2009. Both of these languages are open-source. Python is mainly developed by Guido van Rossum, a Dutch programmer. And the Golang is developed by Google. Golang is new to our computer world. But the growing community of Goalng language, it increases it popularity day by day. Personally, I’m working on both of these languages. That’s why, I have a little experience of both of it.</p><p>I tried to solve<a href="https://leetcode.com/problems/remove-duplicates-from-sorted-array/"> <strong><em>Remove Duplicates from Sorted Array</em></strong></a> problem from <a href="https://leetcode.com/">LeetCode</a>. Here I’ll share the performance test both of these languages. I tried same approaches for solving the same problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E3cw1x3Mn140Kp4BKG6Fvw.png" /><figcaption>Remove Duplicate from Sorted Array LeetCode: Golang vs Python Performance</figcaption></figure><p><em>For python, it took 93 ms runtime and space of 15.6 MB where in Golang it took only 7 ms runtime and 4.4 MB memory.</em></p><p>So, in conclusion, we can say that Goalng is a lot faster than Python in runtime. And in memory, Golang also win. Theoretical research on these two languages shows that Go is typically 40 times faster than Python. For deploying applications on server sites, Go is widely used in recent time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0dabb6c35ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Compiler Vs Interpreter]]></title>
            <link>https://sagoresarker.medium.com/compiler-vs-interpreter-b2615c8691a3?source=rss-10ab0f098d16------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2615c8691a3</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[compiled-language]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[interpreted-languages]]></category>
            <dc:creator><![CDATA[Sagore Sarker]]></dc:creator>
            <pubDate>Thu, 03 Feb 2022 08:01:19 GMT</pubDate>
            <atom:updated>2022-02-03T08:01:19.825Z</atom:updated>
            <content:encoded><![CDATA[<img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2615c8691a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Are ghosts real?Answering a weird question.]]></title>
            <link>https://sagoresarker.medium.com/are-ghosts-existing-the-science-approaches-4bea6db6a478?source=rss-10ab0f098d16------2</link>
            <guid isPermaLink="false">https://medium.com/p/4bea6db6a478</guid>
            <category><![CDATA[ghosts]]></category>
            <category><![CDATA[ghost-in-science]]></category>
            <category><![CDATA[parallel-world]]></category>
            <dc:creator><![CDATA[Sagore Sarker]]></dc:creator>
            <pubDate>Thu, 03 Feb 2022 07:51:31 GMT</pubDate>
            <atom:updated>2022-02-04T04:16:15.791Z</atom:updated>
            <content:encoded><![CDATA[<p>The Science Approach</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vhZTOWfSTYr0PTsz1G2T0Q.jpeg" /><figcaption>Collected From Frepik</figcaption></figure><p>I try to explain my thought about it and try to relate them to science.</p><p>Think about a scenario. You are watching a horror movie. Does a dark shadow appear before the actor? How does it feel?</p><p>Most of the time, for our culture, the term Ghost appears to us. Our grandpa or grandma says some story about ghosts. The approach of representation of the story sometimes crosses a dark line in our hearts. Some of us really believe in ghosts. Personally, I don’t believe in ghosts at all. But what does science say about it? Let’s dig into it.</p><p>You have a little disclaimer. I’m a student of Computer Science and Engineering. Here I share my thought which seems to be related to physics.</p><p>The universe is four-dimensional — three for space, one for time. We are 3D creatures, living in a 3D world but our eyes can show us only two dimensions. The depth that we all think we can see is merely a trick that our brains have learned; a byproduct of evolution putting our eyes on the front of our faces. So, it is crystal clear to us that greater than two-dimensional objects, we can’t see them with our naked eyes. But from our pre-historic culture, we all are known about two supernatural powers. The one is our creature, God and another one are Ghosts. Ghost in culture also has supernatural power. They can control us. Most of us believe in it. If you watched the movie Interstellar by Cristopher Nolan, you saw a theoretical representation of a 5D world. In that movie, the hero falls into a black hole, enters a 5D world, and tries to communicate with us by binary digit. At the end of that movie, with the help of him, his daughter successfully connected the two different dimensional worlds. And the shape of that is quite different than our own world.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PawToVN4mYGqXkuiU6Mvdw.jpeg" /><figcaption>Parallel World: Collected from google.com</figcaption></figure><p>In my point of view, if anything like a ghost has a real existence, it may be in the higher or lower dimension of our known universe. That’s why we can’t see them.</p><p>In string theory, there are 10 dimensions are proposed. Although the rest of the 6 dimensions (except height, width, length, and time) are in a theoretical manner, they exist in our nature.</p><p>In this article, I propose a theoretical concept of ghosts. Ghosts are those objects or personalities who belong to a different dimension from us.</p><p>Then, how do they think? As I said early, they are from another dimension, they may look like us or any other shape. So, they have a processing unit like the human brain that helps them to think.</p><p>In the parallel world, there is a possibility to have a reflected world. In the parallel world, maybe have an existence of you having a cup of tea and go through this article. Maybe your reflection from another dimension, do the same as like you. They all are beside us, but we only can’t see them because of having different dimensions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4bea6db6a478" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>