<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dennis</title>
    <description>The latest articles on DEV Community by Dennis (@pilatdennis).</description>
    <link>https://dev.to/pilatdennis</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F90901%2F76b8ac7b-a87d-456e-8e03-4cf66b7a0474.jpg</url>
      <title>DEV Community: Dennis</title>
      <link>https://dev.to/pilatdennis</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pilatdennis"/>
    <language>en</language>
    <item>
      <title>I Created An Application That Saved Me 2.6 Hours Each Year</title>
      <dc:creator>Dennis</dc:creator>
      <pubDate>Sat, 11 Jul 2020 03:36:42 +0000</pubDate>
      <link>https://dev.to/pilatdennis/i-created-an-application-that-saved-me-2-6-hours-each-year-353b</link>
      <guid>https://dev.to/pilatdennis/i-created-an-application-that-saved-me-2-6-hours-each-year-353b</guid>
      <description>&lt;p&gt;Do you use automation in your day-to-day work life? Now I'm no Python developer, but I thought of developing a small application which automated a manual and repetitive task. I quickly created a small Python script which automatically fills out an online form which generates an invoices for me on submission.&lt;/p&gt;

&lt;p&gt;Manually creating an invoice would take me around three minutes every time I do this. But with the script, all I have to do is provide the invoice number and invoice amount... and it fills out and submits the form for me. Leaving me with reviewing the .PDF invoice to make sure everything is correct. All of this done in less than five seconds.&lt;/p&gt;

&lt;p&gt;What sort of things have you automated? Big or small?&lt;/p&gt;

&lt;p&gt;52 Sundays in a year (the day I typically create and send my invoices...) * 3 minutes / 60 minutes = roughly 2.6 hours saved per year.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9jI84t4Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://i.imgur.com/ZT92S4y.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9jI84t4Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://i.imgur.com/ZT92S4y.gif" alt="Here's a .gif that shows me running the Python console application, entering in the invoice number and amount to be paid... resulting in a invoice .pdf to review and download."&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Here's a .gif that shows me running the Python console application, entering in the invoice number and amount to be paid... resulting in a invoice .pdf to review and download.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>automation</category>
      <category>savingtime</category>
      <category>automate</category>
    </item>
    <item>
      <title>An Introduction to Big O Notation</title>
      <dc:creator>Dennis</dc:creator>
      <pubDate>Sat, 11 Jul 2020 03:21:03 +0000</pubDate>
      <link>https://dev.to/pilatdennis/an-introduction-to-big-o-notation-146k</link>
      <guid>https://dev.to/pilatdennis/an-introduction-to-big-o-notation-146k</guid>
      <description>&lt;p&gt;&lt;em&gt;Note: This article is being incomplete and will not be updated. But still contains a lot of information about Big O Notation.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It doesn't matter whether you're self-taught or you went to school to study computer science. If you're looking to be hired as a software engineer, you're going to need to understand Big O notation along with calculating time/space complexity.&lt;/p&gt;

&lt;p&gt;There's a high probability that a question, such as  &lt;em&gt;"Can you tell me the time/space complexity of this algorithm?"&lt;/em&gt; or  &lt;em&gt;"What's the Big O of this function?"&lt;/em&gt; will appear in your next technical interview.&lt;/p&gt;

&lt;p&gt;My intention with writing this article is to help you understand Big O notation so that when the time comes and you're in an technical interview... you'll feel confident in answering a question about time/space complexity and Big O notation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let's begin.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Big O notation?
&lt;/h3&gt;

&lt;p&gt;We use Big O notation to determine  &lt;strong&gt;how fast an algorithm's runtime is, as the number of operations/inputs for that algorithm increases.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By knowing the Big O of our algorithm, we're able to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Know how well our algorithm performs as the number of operations increases (&lt;strong&gt;&lt;em&gt;in its worst-case scenario&lt;/em&gt;&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;  Compare algorithms to determine which algorithm is faster and takes less memory.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I want to emphasize, when we use Big O notation, we're discovering how  efficient  an algorithm is in  &lt;strong&gt;&lt;em&gt;its  worst-case  runtime&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  How is Big O notation written and said?
&lt;/h3&gt;

&lt;p&gt;Depending on the algorithm, you'll may see Big O notation written in a variety of forms like this: O(n), O(1), O(log n), and more. "n" in this case, is the number of operations in an algorithm. The speed of an algorithm isn’t measured in seconds, but in growth of the number of operations.&lt;/p&gt;

&lt;p&gt;But, how would you tell somebody that an algorithm has a Big O notation of O(n), O(1), O(log n)?&lt;/p&gt;

&lt;p&gt;Give it a try (&lt;em&gt;I encourage you to say it out loud)&lt;/em&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  O(n) = Big O of n_._&lt;/li&gt;
&lt;li&gt;  O(1) = Big O of one.&lt;/li&gt;
&lt;li&gt;  O(log n) = Big O of log n.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Most times, you can leave out the word "Big" and just say O of ...&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Why does it matter if we use Big O notation?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;There's a time and place to use Big O notation.&lt;/p&gt;

&lt;p&gt;If your goal is to create an application that doesn't require a lot of operations/inputs and more people won't be using it then you're most likely not going to have to stress out about Big O notation. But, if you're working at a company such as: Amazon, Google, Facebook, Twitter, etc... your job will require you to design algorithms that'll be used by millions.&lt;/p&gt;

&lt;p&gt;When millions of people are using software that rely on your algorithm, you're going to want to start asking yourself questions such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Is my algorithm readable?&lt;/li&gt;
&lt;li&gt;  Is my algorithm fast?&lt;/li&gt;
&lt;li&gt;  Can I reduce the number of operations my algorithm does while maintaining readability and speed?&lt;/li&gt;
&lt;li&gt;  How much memory is my algorithm taking?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There's always limits to how much you can improve in one area before another area starts suffering. And what I mean by this is, if I focus purely on making my algorithm as fast as possible, there's a good chance that my algorithm won't be as easy to read or my algorithm maybe my algorithm would require more space in trade for more speed.&lt;/p&gt;

&lt;p&gt;These are the types of things you must consider when designing your algorithms and by thinking about these things, they make you a better engineer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Speed isn't everything
&lt;/h3&gt;

&lt;p&gt;Obviously you want your code to be fast, but you also want to be able to come back to your code (or have somebody with fresh eyes) nine months later and be able to understand what your code is doing.&lt;/p&gt;

&lt;p&gt;Consider Big O notation as something that you can add to your software engineering toolkit. You have a bunch of tools in your toolbox such as: data structures, design patterns, and sorting algorithms. You then use these tools in your toolbox to create different types of algorithms. Now you're able to use Big O notation to compare the algorithms you've created with each other to select the algorithm that'll better fit your need.&lt;/p&gt;

&lt;p&gt;Before we start moving onto time and space complexities, I think it's important to mention that the reason why it's incredibly important to use something like Big O notation, especially when building for scalability is because  &lt;strong&gt;everything seems fast when there's only a small amount of inputs and operations being done.&lt;/strong&gt; It's only when you get to large amounts of inputs and operations that you can really see how efficient your algorithm really is.&lt;/p&gt;

&lt;h3&gt;
  
  
  Big-O Complexity Chart
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SU844ODn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media-exp1.licdn.com/dms/image/C5612AQFy-JKJhBT2pA/article-inline_image-shrink_1000_1488/0%3Fe%3D1599696000%26v%3Dbeta%26t%3D8qYBFZF1LWmT1IejKFAL2JY1gYrd4W-d-HcBpVtzSrY" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SU844ODn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media-exp1.licdn.com/dms/image/C5612AQFy-JKJhBT2pA/article-inline_image-shrink_1000_1488/0%3Fe%3D1599696000%26v%3Dbeta%26t%3D8qYBFZF1LWmT1IejKFAL2JY1gYrd4W-d-HcBpVtzSrY" alt="No alt text provided for this image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before we get into calculating and understanding time and space complexities, above is a chart courtesy of  &lt;em&gt;(&lt;a href="https://www.bigocheatsheet.com"&gt;https://www.bigocheatsheet.com&lt;/a&gt;)&lt;/em&gt; which shows us complexities of common algorithms. I recommend bookmarking this website as it helps remembering the complexities and how well they are.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do we use this chart?
&lt;/h3&gt;

&lt;p&gt;When we figure out the Big O notation of our algorithm, we're able to use this chart to identify how our algorithm performs either in time or space complexity. For example, If we figure out that our algorithm is O(n), we can look at this chart to find the line representing O(n). Notice that as the number of elements increase (goes further to the right along the x-axis), we notice that the number of operations (y axis) doesn't increase as much. The chart says that an algorithm with O(n)... is fair.&lt;/p&gt;

&lt;h3&gt;
  
  
  Time complexity
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Big O notation can be used for describing two things&lt;/strong&gt;: Time complexity and Space complexity. It's important to know how to find and describe both of them using Big O notation.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to find the time complexity in Big O notation
&lt;/h3&gt;

&lt;p&gt;We find the time complexity by counting the number of operations in an algorithm and then using a chart like above to determine whether that time complexity is good or bad.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Our first complexity, O(1) - Constant Time&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--icLknKII--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media-exp1.licdn.com/dms/image/C5612AQGhYmEaSOQg_Q/article-inline_image-shrink_1000_1488/0%3Fe%3D1599696000%26v%3Dbeta%26t%3Dl37f-f-l0IxoDJ580EOpgVqoERudwhCDyG_SCA0zrsM" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--icLknKII--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media-exp1.licdn.com/dms/image/C5612AQGhYmEaSOQg_Q/article-inline_image-shrink_1000_1488/0%3Fe%3D1599696000%26v%3Dbeta%26t%3Dl37f-f-l0IxoDJ580EOpgVqoERudwhCDyG_SCA0zrsM" alt="No alt text provided for this image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, I have a function named functionOne. In it, I initialized an integer named total and set it equal to 42. Afterwards, I wrote to the console that total.&lt;/p&gt;

&lt;p&gt;There were two operations done, each of these operations were O(1). There was no loops at all, very quickly we initialized an integer and displayed it to console. Every time we invoke this function, it will always be "O of one".  &lt;strong&gt;Having a  time complexity, O of one.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You may have noticed that when we counted the total amount of operations it was O(2) but for then I said this function was O(1) - Constant Time. There are some simplifying rules that I will get to later. For now, know that this is what constant time and a time complexity of O(1) looks like... no loops. It's important to remember that O(1) stands for Constant Time.&lt;/p&gt;

&lt;p&gt;Here are some more examples of  &lt;strong&gt;O(1) - Constant Time&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--P5KAs8co--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media-exp1.licdn.com/dms/image/C5612AQH9bpdvYZYK-A/article-inline_image-shrink_1000_1488/0%3Fe%3D1599696000%26v%3Dbeta%26t%3DYINhpZ4qPp4t5gi-DF3-LVv7aNJkUWgFtbI-e0LjQoY" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P5KAs8co--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media-exp1.licdn.com/dms/image/C5612AQH9bpdvYZYK-A/article-inline_image-shrink_1000_1488/0%3Fe%3D1599696000%26v%3Dbeta%26t%3DYINhpZ4qPp4t5gi-DF3-LVv7aNJkUWgFtbI-e0LjQoY" alt="No alt text provided for this image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--x1S5pC_Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media-exp1.licdn.com/dms/image/C5612AQFvMa2woV94Qw/article-inline_image-shrink_1000_1488/0%3Fe%3D1599696000%26v%3Dbeta%26t%3DuYVUE4mMgiFP7MQEUuFFLVl-KiRJVUz2R5ZN7Xn1luU" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--x1S5pC_Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media-exp1.licdn.com/dms/image/C5612AQFvMa2woV94Qw/article-inline_image-shrink_1000_1488/0%3Fe%3D1599696000%26v%3Dbeta%26t%3DuYVUE4mMgiFP7MQEUuFFLVl-KiRJVUz2R5ZN7Xn1luU" alt="No alt text provided for this image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This graph represents O(1), every time we invoke a function with a time complexity of O(1), we know that it's going to be really fast because the number of operations is the same each time. Notice that the line is a horizontal line at 1?&lt;/p&gt;

&lt;p&gt;What if our algorithm was O(2)? Then we'd have a horizontal line at y = 2, it'd still be a horizontal line with no changes in the number of operations. So if we see any constants e.g. O(500), O(32), O(17), etc... we always simplify it to O(1) because O(1) has the same behavior as any other constant.&lt;/p&gt;

&lt;h3&gt;
  
  
  Our second complexity, O(n) - Linear Time
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0Rxi6Jct--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media-exp1.licdn.com/dms/image/C5612AQGWQRtgsc-qIA/article-inline_image-shrink_1000_1488/0%3Fe%3D1599696000%26v%3Dbeta%26t%3DY8vfxC_Ff4jayzy1EiUStPmJupGP-7PboAijx2WqQ-I" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0Rxi6Jct--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media-exp1.licdn.com/dms/image/C5612AQGWQRtgsc-qIA/article-inline_image-shrink_1000_1488/0%3Fe%3D1599696000%26v%3Dbeta%26t%3DY8vfxC_Ff4jayzy1EiUStPmJupGP-7PboAijx2WqQ-I" alt="No alt text provided for this image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is our second complexity, O(n) - Linear Time. A loop is considered O(n).&lt;/p&gt;

&lt;p&gt;Do you remember what the n stands for in O(n)?  &lt;strong&gt;&lt;em&gt;# of operations&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The reason a loop is O(n) is because a loop would typically go through the loop, n amount of times. You can also define a specific amount of times you want to loop through a loop... this still results in looping n amount of times. As a result, this is known as linear time. As the number of elements(inputs) increase, the number of operations increase.&lt;/p&gt;

&lt;p&gt;O(n) Linear Time = for loops, while loops through n items.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ddQkyc5M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media-exp1.licdn.com/dms/image/C5612AQECgEU6DGoH0w/article-inline_image-shrink_1000_1488/0%3Fe%3D1599696000%26v%3Dbeta%26t%3D7iYVIdwgxhrpvqDZtzubuYHrojPYI5BHsZXKX5UjYIA" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ddQkyc5M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media-exp1.licdn.com/dms/image/C5612AQECgEU6DGoH0w/article-inline_image-shrink_1000_1488/0%3Fe%3D1599696000%26v%3Dbeta%26t%3D7iYVIdwgxhrpvqDZtzubuYHrojPYI5BHsZXKX5UjYIA" alt="No alt text provided for this image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In linear time, as the number of elements increase, the number of operations increase and time complexity is longer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Our third complexity, O(n²) - Quadratic Time
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3lnKU7Q7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media-exp1.licdn.com/dms/image/C5612AQH2wvTrqqhw6Q/article-inline_image-shrink_1000_1488/0%3Fe%3D1599696000%26v%3Dbeta%26t%3DG62QMg1zSwoScFKMWCutQ_Fu3KsjtXdVuUZ4_l_Mhf8" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3lnKU7Q7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media-exp1.licdn.com/dms/image/C5612AQH2wvTrqqhw6Q/article-inline_image-shrink_1000_1488/0%3Fe%3D1599696000%26v%3Dbeta%26t%3DG62QMg1zSwoScFKMWCutQ_Fu3KsjtXdVuUZ4_l_Mhf8" alt="No alt text provided for this image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Looking at our Big O cheatsheet, notice that the Quadratic Time complexity is in the red. It's horrible. For example, if we have 400 operations, we end up having, 160,000 operations. Now we're starting to have a better understanding of why Big O notation is important especially when dealing with scalability.&lt;/p&gt;

&lt;p&gt;There's more to Big O Notation, but I hope this article can serve as an introduction to Big O Notation. And an article you can refer to along with your other resources.&lt;/p&gt;

&lt;p&gt;Thank you for reading.&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>bigonotation</category>
      <category>bigo</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>An Introduction to Hash Tables</title>
      <dc:creator>Dennis</dc:creator>
      <pubDate>Sat, 11 Jul 2020 00:24:08 +0000</pubDate>
      <link>https://dev.to/pilatdennis/an-introduction-to-hash-tables-4lib</link>
      <guid>https://dev.to/pilatdennis/an-introduction-to-hash-tables-4lib</guid>
      <description>&lt;p&gt;When it comes to technical interviews, you're going to want to know Arrays and Hash Tables as they're common to show up in your interview.&lt;/p&gt;

&lt;p&gt;Different languages has different implementations of Hash Tables or they have data structures which are similar to Hash Tables. In Python, they're dictionaries. In JavaScript, you have Objects, within Java you have Maps, and in C# you can simply create a new Hash Table using new HashTable().&lt;/p&gt;

&lt;p&gt;Hash Tables are an extremely useful data structure which allow you to store information using key-value pairs. Very similar to a dictionary or an object that you find in JavaScript.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QXAgXXoM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/850krl7rl4pqldflk809.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QXAgXXoM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/850krl7rl4pqldflk809.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, using C#... I created a new Hash Table and added a key, "totalItems", which has a value of 5. Right away, we see some benefits here. Extremely fast lookup, O(1). To find how many total items my cart has, all I would need to do is a look up using the key to get my value.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N6Ef1BIx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/o92muqmq6omutepf4pa1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N6Ef1BIx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/o92muqmq6omutepf4pa1.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is convenient because if I used an Array, I'd need to do some sort of O(n) lookup. But even then, I'm not sure how I would describe that the value at index n, relates to the total items in my cart. So a Hash Table provides us the ability to quickly look up a value using a key and we're able to understand the relationship between the key and value based on the naming of the key. In this example, "totalItems", the key, is used as an index to find the value in memory.&lt;/p&gt;

&lt;p&gt;In a Hash Table, memory isn't zero-indexed based like an Array. The key-value pair is stored in random memory addresses. Now you might be asking, "How does a Hash Table determine where in memory key:totalItems and it's value live?". That's a great question and to answer that we have to talk about a Hash Function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--F9voKKd---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bdzpg1ir8eoxfyl10pxg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--F9voKKd---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bdzpg1ir8eoxfyl10pxg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a black-box example of what a Hash Function does. It takes in the key value, in this example, "totalItems" and within a bucket, allocates at a random memory location the value of the key.&lt;/p&gt;

&lt;p&gt;A Hash Function isn't something that's only specific to Hash Tables. Hash Functions are used in message digest, password verification, cryptography, and more. All a Hash Function is, is something that generates a value of fixed length for each input that it gets. We give it an input and the function generates a random pattern.&lt;/p&gt;

&lt;p&gt;Let's take an md5 hash generator for example. I'm using &lt;a href="https://www.md5hashgenerator.com/"&gt;https://www.md5hashgenerator.com/&lt;/a&gt; for instance. And I enter in the string input, totalItems. The Hash Function then uses an MD5 hash to generate a random pattern and gives me the following hash: 3568acf60dc232a1e15412f1add7ed66&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lWyaFbLd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jb64548bnhb6fjyuq3he.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lWyaFbLd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jb64548bnhb6fjyuq3he.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some things to consider is that a Hash is typically one way. Given a Hash you usually don't find out the input. And no matter how many times I run "totalItems" into the MD5 hash function, I'm always going to get 3568acf60dc232a1e15412f1add7ed66. One hash per input. It I edit the key in any way, let's say my new key name is "totalItem" then the hash changes completely. This is the new hash:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yiv7QUrQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/p7bwltvopfjrdvs8zy6d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yiv7QUrQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/p7bwltvopfjrdvs8zy6d.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Even if I make a tiny change to the input such as capitalizing a letter or removing a letter, once run through the Hash Function would input an entirely new Hash for the input.&lt;/p&gt;

&lt;p&gt;A hash function is idempotent which is a fancy term for meaning a function, given an input, always outputs the same output. This is important because we want to make sure that we're retrieving a key's correct value whenever we use the key in a Hash Table.&lt;/p&gt;

&lt;p&gt;Remember earlier that I said the value for the key "totalItems" was 5. I should expect to receive the value, 5, every time I use the key, "totalItems" in the Hash Table. This is why a Hash Function being idempotent is important. Since ultimately, we use the hash to find where in memory the correct value for the key is.&lt;/p&gt;

&lt;p&gt;Depending on the hashing function, it may be faster or slower. But typically a Hash Function is O(1).&lt;/p&gt;

&lt;p&gt;One problem that occurs when using Hash Tables is Hash Collisions. Which is when the Hash Function assigns multiple one or more keys to the same bucket. There's nothing telling the Hash Function to evenly distribute or check that something exists in a bucket before giving a key a space in memory. With enough data and limited memory, Hash tables are always going to run into hash collisions eventually.&lt;/p&gt;

&lt;p&gt;One way to deal with Hash Collisions is by using Linked Lists (Separate Chaining) and other methods but I won't be going into those. Consider checking out &lt;a href="https://en.wikipedia.org/wiki/Hash_table#Collision_resolution"&gt;https://en.wikipedia.org/wiki/Hash_table#Collision_resolution&lt;/a&gt; to learn more about the various ways to resolve Hash Collisions. Due to Hash Collisions, occasionally, lookup may become O(n) instead of O(1).&lt;/p&gt;

&lt;p&gt;I'm unable to upload my gif, but if you visit: &lt;a href="https://i.imgur.com/C7uEpIU.gifv"&gt;https://i.imgur.com/C7uEpIU.gifv&lt;/a&gt; notice what happens to 24 at index 11, when 232 was added? A collision occurred. And using separate chaining, 232 took 24's original spot but there's a Linked List connection to 24. So 24 is never actually gone.&lt;/p&gt;

&lt;p&gt;You can play around with: &lt;a href="https://www.cs.usfca.edu/%7Egalles/visualization/OpenHash.html"&gt;https://www.cs.usfca.edu/~galles/visualization/OpenHash.html&lt;/a&gt; to see Hash Collisions yourself.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Jb84j1d9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/17vbgh64rgxhejizjneo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Jb84j1d9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/17vbgh64rgxhejizjneo.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By Jorge Stolfi - Own work, CC BY-SA 3.0, &lt;a href="https://commons.wikimedia.org/w/index.php?curid=6471915"&gt;https://commons.wikimedia.org/w/index.php?curid=6471915&lt;/a&gt;&lt;br&gt;
As you can see in this image, there's a hash collision that occurs at bucket # 1. Sandra Dee and John Smith share the same bucket. This is resolved using separate chaining.&lt;/p&gt;

&lt;p&gt;Ending this article, Hash Tables have a fast lookup, fast inserts, fast deletions, and flexible keys. But they're unordered, have slow key iteration, and you need to be careful about Hash Map collisions. They're an important and useful data structures which are commonly used in technical interviews.&lt;/p&gt;

&lt;p&gt;I hope this article has helped out out a little bit. I don't want this article to be an end-all to your studying and highly recommend checking out other resources to aid you in your data structures and algorithms studying.&lt;/p&gt;

&lt;p&gt;This article was made for a group that I organized, "Data Structures and Algorithms". If you're interested in study/practicing data structures and algorithms... consider joining us at &lt;a href="https://www.meetup.com/Study-Data-Structures-and-Algorithms/"&gt;https://www.meetup.com/Study-Data-Structures-and-Algorithms/&lt;/a&gt; we're in the Greater Seattle Area and have met up once every single week, usually Tuesdays or Thursdays. We're almost at 100 members, if you're interested, come join us and have a great time meeting others and studying together.&lt;/p&gt;

&lt;p&gt;We're always looking for people to help volunteer their time and lead events. If you're interested, messages are always welcome.&lt;/p&gt;

&lt;p&gt;Thank you.&lt;/p&gt;

&lt;p&gt;Other resources that you may find helpful:&lt;/p&gt;

&lt;p&gt;᛫ &lt;a href="https://bit.ly/2ZHWDmi"&gt;https://bit.ly/2ZHWDmi&lt;/a&gt; [ELI5: Hash Tables and their importance]&lt;/p&gt;

&lt;p&gt;᛫ &lt;a href="https://bit.ly/3f6bYnb"&gt;https://bit.ly/3f6bYnb&lt;/a&gt; [The Codeless Guide to Hashing and Hash Tables]&lt;/p&gt;

&lt;p&gt;᛫ &lt;a href="https://bit.ly/31SgXnE"&gt;https://bit.ly/31SgXnE&lt;/a&gt; [Data Structures: Hash Tables Youtube Video]&lt;/p&gt;

&lt;p&gt;᛫ &lt;a href="https://bit.ly/3iFYn8q"&gt;https://bit.ly/3iFYn8q&lt;/a&gt; [(This link opens a PDF in your browser) A lecture from University of Washington, relevant information about Hash Table starts at slide 12 and up.]&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>datastructures</category>
      <category>datastructure</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>OBS Live Stream -&gt; Instagram Live Stream Project</title>
      <dc:creator>Dennis</dc:creator>
      <pubDate>Sat, 16 Nov 2019 06:39:57 +0000</pubDate>
      <link>https://dev.to/pilatdennis/obs-live-stream-instagram-live-stream-project-2hlb</link>
      <guid>https://dev.to/pilatdennis/obs-live-stream-instagram-live-stream-project-2hlb</guid>
      <description>&lt;p&gt;The project is OBS live stream -&amp;gt; Instagram Live Stream, there's a PHP repository here: &lt;a href="https://github.com/JRoy/InstagramLive-PHP"&gt;https://github.com/JRoy/InstagramLive-PHP&lt;/a&gt; which relies on this Instagram-API: &lt;a href="https://github.com/mgp25/Instagram-API/"&gt;https://github.com/mgp25/Instagram-API/&lt;/a&gt;. I thought it would be neat if I can do something similar but instead of PHP use TypeScript/Node or even Electron (I've never done Electron before).&lt;/p&gt;

&lt;p&gt;Would anyone be interested in doing this project with me? The inspiration for this project is: I think it would be cool to be able to live stream your coding on Instagram live.&lt;/p&gt;

</description>
      <category>electron</category>
      <category>typescript</category>
      <category>node</category>
    </item>
    <item>
      <title>I created a Discord channel meant for developers to come together/think of an idea/work on a project together.</title>
      <dc:creator>Dennis</dc:creator>
      <pubDate>Mon, 28 Jan 2019 07:49:46 +0000</pubDate>
      <link>https://dev.to/pilatdennis/i-created-a-discord-channel-meant-for-developers-to-come-togetherthink-of-an-ideawork-on-a-project-together-3ge3</link>
      <guid>https://dev.to/pilatdennis/i-created-a-discord-channel-meant-for-developers-to-come-togetherthink-of-an-ideawork-on-a-project-together-3ge3</guid>
      <description>&lt;p&gt;Hi Dev.to!&lt;/p&gt;

&lt;p&gt;For me, it's always been difficult to find like-minded developers or find a place for the sole purpose of thinking of an idea and working together. Because of that, Developers Grove was created! I created a Discord channel meant for developers to come together, think of ideas, and work on those ideas together as a project. It started 3 days ago and now we're over 120 members strong! Many people in the chat have told me they've been looking for something like this as well. I'm really glad I wasn't the only one feeling like this and knowing that the idea has been validated. &lt;/p&gt;

&lt;p&gt;I wanted to invite the Dev.to community to this Discord channel as well.&lt;/p&gt;

&lt;p&gt;Here is the link to the Discord channel: &lt;a href="https://discord.gg/29TK6DW"&gt;https://discord.gg/29TK6DW&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Come and introduce yourself, let others know what project ideas you have, are interested in, and see if you want to join any projects yourself! We'll be waiting for you in the Grove! :)&lt;/p&gt;

</description>
      <category>discord</category>
      <category>javascript</category>
      <category>node</category>
      <category>projects</category>
    </item>
    <item>
      <title>What does "single-piece flow" or "one-piece flow" development mean to you?</title>
      <dc:creator>Dennis</dc:creator>
      <pubDate>Wed, 26 Dec 2018 09:24:52 +0000</pubDate>
      <link>https://dev.to/pilatdennis/what-does-single-piece-flow-or-one-piece-flow-development-mean-to-you-154m</link>
      <guid>https://dev.to/pilatdennis/what-does-single-piece-flow-or-one-piece-flow-development-mean-to-you-154m</guid>
      <description>

&lt;p&gt;As the title states, "What does "single-piece flow" or "one-piece flow" development mean to you?". I'm currently reading the book, "The Phoneix Project" by Gene Kim, and I've learned a lot. In the book, it mentioned developing a single-piece flow development system. When you hear that, what does that mean to you? What are some tools/resources/procedures you use to do this? When those words come to me, I instantly think about Git, branching, features, merging, etc...&lt;/p&gt;


</description>
      <category>softwaredevelopment</category>
      <category>projectmanagement</category>
    </item>
  </channel>
</rss>
