<?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: ahmad-cod</title>
    <description>The latest articles on DEV Community by ahmad-cod (@ahmadcod).</description>
    <link>https://dev.to/ahmadcod</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%2F553848%2Ffa3a9c6e-bf2a-4e00-972a-2c5a89098571.png</url>
      <title>DEV Community: ahmad-cod</title>
      <link>https://dev.to/ahmadcod</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ahmadcod"/>
    <language>en</language>
    <item>
      <title>Hash Tables (And Why You Should Care)</title>
      <dc:creator>ahmad-cod</dc:creator>
      <pubDate>Sat, 18 Apr 2026 21:41:19 +0000</pubDate>
      <link>https://dev.to/ahmadcod/im-learning-hash-tables-and-why-you-should-care-38k</link>
      <guid>https://dev.to/ahmadcod/im-learning-hash-tables-and-why-you-should-care-38k</guid>
      <description>&lt;p&gt;I have a goal for my learning: to gain mastery so quickly and deeply that I can help my beloved ones master it too. Today, that topic is Hash Tables.&lt;/p&gt;

&lt;p&gt;If you’ve ever wondered how Google finds a search result in milliseconds or how a database finds your profile out of millions of users, the answer is usually a Hash Table.&lt;/p&gt;

&lt;p&gt;To understand how they work, let’s step away from the computer and walk into a local provision store.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7u1cm0hsrr1t5ec2tvg6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7u1cm0hsrr1t5ec2tvg6.png" alt="Ibrahim Provision Store" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Imagine &lt;strong&gt;Ibrahim&lt;/strong&gt; runs a busy provision store. His brother, Mubarak, just arrived in the city to help him out.&lt;/p&gt;

&lt;p&gt;You walk in to buy 2 dozen items. Mubarak is new and doesn’t know the prices yet. For every item you ask about, he has two ways to find the answer:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The Catalogue Method (O(n)):&lt;/strong&gt; He opens a long notebook listing every item in the store. He has to flip through the pages one by one. If the item is at the very end, it takes forever. This is Linear Time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The Ibrahim Method (O(1)):&lt;/strong&gt; He shouts, "Ibrahim, how much is the Milo?" Ibrahim has a mental map of the store and knows the price instantly. This is Constant Time.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A Hash Table is the "Ibrahim" of data structures. It turns a slow search into an instant response.&lt;/p&gt;

&lt;h3&gt;
  
  
  How It Works: The Brain and the Shelves
&lt;/h3&gt;

&lt;p&gt;A Hash Table is essentially two things working together: A Hash Function and An Array.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The Array: These are the physical shelves where data is stored.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Hash Function: This is Ibrahim’s "brain." It takes an input (like "Milo") and instantly spits out a location (like "Shelf #4").&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  What makes a "Good" Hash Function?
&lt;/h4&gt;

&lt;p&gt;For Ibrahim to stay fast, his mental map (the hash function) needs three specific traits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deterministic: If you ask for the price of Milo today and tomorrow, he must give the same answer.&lt;/li&gt;
&lt;li&gt;Efficient: He should be able to calculate the location instantly without needing a calculator.&lt;/li&gt;
&lt;li&gt;Uniform Distribution: He shouldn't put everything on Shelf #1. He needs to spread items out evenly across the store so the shelves don't get cluttered.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Collisions and Chaining
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgq593u0zgfyeejzpq5y3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgq593u0zgfyeejzpq5y3.png" alt="Chaining analogy with buckets" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the real world, two different items might "hash" to the same shelf. This is called a &lt;strong&gt;Collision&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;To fix this, we use Separate Chaining. Think of it as putting a small bucket on each shelf. If two different items are assigned to Shelf #4, Ibrahim just places them both in the bucket. When you ask for one, he goes to Shelf #4 and quickly looks through the small bucket.&lt;/p&gt;

&lt;p&gt;As long as the buckets (the "chains") stay short, Ibrahim stays fast!&lt;/p&gt;

&lt;h3&gt;
  
  
  The Trade-offs: Speed vs. Order
&lt;/h3&gt;

&lt;p&gt;Hash Tables are fast, but they aren't magic. They come with specific limitations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The Memory Tax: To stay fast, you need empty shelves. Hash tables use more memory than a simple list because they prioritize speed over space.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Chaos Factor: Ibrahim doesn't keep items in alphabetical order. If you need a sorted list of all your items, a Hash Table is the wrong tool because it is inherently unordered.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Summary: Modeling Relationships
&lt;/h3&gt;

&lt;p&gt;At its core, a Hash Table is about relationships.&lt;/p&gt;

&lt;p&gt;Identity Number → Person's Details&lt;br&gt;
Item Name → Price&lt;br&gt;
Username → User Object&lt;/p&gt;

&lt;p&gt;By combining a smart "brain" (the function) with organized "shelves" (the array), we can handle massive amounts of data without ever losing our speed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Think about the apps you use every day—like WhatsApp or Instagram. Where do you think they use Hash Tables to keep things fast? Let’s talk about it in the comments!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>datastructures</category>
      <category>computerscience</category>
      <category>dsasaturday</category>
    </item>
    <item>
      <title>Collision detection in 2D game development with JavaScript</title>
      <dc:creator>ahmad-cod</dc:creator>
      <pubDate>Wed, 05 Oct 2022 21:43:33 +0000</pubDate>
      <link>https://dev.to/ahmadcod/collision-detection-in-2d-game-development-with-javascript-47ao</link>
      <guid>https://dev.to/ahmadcod/collision-detection-in-2d-game-development-with-javascript-47ao</guid>
      <description>&lt;p&gt;&lt;strong&gt;Collision detection&lt;/strong&gt; also known as &lt;strong&gt;hit testing&lt;/strong&gt; is simply determining when two objects come in &lt;strong&gt;contact&lt;/strong&gt; with one another.&lt;/p&gt;

&lt;p&gt;The collision of objects underlies most game experiences and user-interfaces.&lt;br&gt;
Baseball bats collide with balls, zombies bump into walls, and Mario lands on platforms and stomps turtles. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4vfg121qchih9ic08eaf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4vfg121qchih9ic08eaf.png" alt="Mario lands on platforms and stomps turtles"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  A General Formula For Collision Detection
&lt;/h4&gt;

&lt;p&gt;Detect the positions of each object, compare and calculate if they're overlapping.&lt;/p&gt;
&lt;h4&gt;
  
  
  Instances
&lt;/h4&gt;

&lt;p&gt;Examples of collision between two objects:-&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;POINT/POINT&lt;/li&gt;
&lt;li&gt;CIRCLE/CIRCLE&lt;/li&gt;
&lt;li&gt;&lt;p&gt;RECTANGLE/RECTANGLE&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Point/Point&lt;/strong&gt;&lt;br&gt;
The easiest collision to test is between two points, to test if they're colliding, we simply check if their X and Y co-ordinates are the same! (i.e if their positions are same).&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (x1 == x2 &amp;amp;&amp;amp; y1 == y2) {
  // Points are in the same place: collision
}
else {
// Not colliding
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Circle ⭕ / Circle ⭕&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Imagine you have two circles, each with their own radius. They are placed with a distance between them. The circles would overlap if the &lt;strong&gt;distance&lt;/strong&gt; is &lt;strong&gt;smaller&lt;/strong&gt; than the &lt;strong&gt;sum&lt;/strong&gt; of the &lt;strong&gt;radius&lt;/strong&gt; of both circles.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj743txz8xkhlt4xhsacn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj743txz8xkhlt4xhsacn.png" alt="Calculating the distance between 2 circles"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Calculating the distance between the center of the two circles requires us to remember middle school math and the Pythagorean Theorem:&lt;br&gt;
&lt;code&gt;Opp² + Adj² = Hyp²&lt;/code&gt; simply &lt;code&gt;∆x² + ∆y² = d²&lt;/code&gt;;&lt;br&gt;
&lt;code&gt;d = √(∆x² + ∆y²)&lt;/code&gt;;&lt;/p&gt;

&lt;p&gt;Translated to code, it looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;d = Math.sqrt((∆x*∆x) + (∆y*∆y))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, if this distance is smaller than or equal to the radius of circle-a plus radius of circle-b, the circles overlap or touch. This principle is used in the next function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const circlesCollide = (x1, y1, r1, x2, y2, r2) =&amp;gt; {

    // Calculate the distance between the two circles
    let squareDistance = (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);

    // When the distance is smaller or equal to the sum
    // of the two radius, the circles touch or overlap
    return squareDistance &amp;lt;= ((r1 + r2) * (r1 + r2))
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see, the formula is tweaked a bit. Multiplication is much faster than getting the square root with &lt;br&gt;
&lt;code&gt;Math.sqrt()&lt;/code&gt; so the distance is calculated without getting the root and the sum of the radii is multiplied by itself. The outcome stays the same, but the performance is better.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>gamedev</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Starting an internship with the Zuri Team</title>
      <dc:creator>ahmad-cod</dc:creator>
      <pubDate>Sun, 15 Aug 2021 16:17:49 +0000</pubDate>
      <link>https://dev.to/ahmadcod/starting-an-internship-with-the-zuri-team-55le</link>
      <guid>https://dev.to/ahmadcod/starting-an-internship-with-the-zuri-team-55le</guid>
      <description>&lt;h2&gt;
  
  
  Hello World,
&lt;/h2&gt;

&lt;p&gt;I'm &lt;strong&gt;Ahmad Aroyehun&lt;/strong&gt;, I'm about to embark on an interesting journey with the &lt;a href="https://zuri.team"&gt;Zuri Team&lt;/a&gt;, and I hope to share my adventure with you all.&lt;/p&gt;

&lt;h3&gt;
  
  
  Goals for the 8 weeks Internship
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Understand my frontend skills (HTML, CSS, Javascript and React) better.&lt;/li&gt;
&lt;li&gt;Learn Typescript and Graph ql.&lt;/li&gt;
&lt;li&gt;Build Real life Projects.&lt;/li&gt;
&lt;li&gt;Share the difficulties and the interesting part of the internship every Sunday of each week.&lt;/li&gt;
&lt;li&gt;Work and collaborate with other developers.&lt;/li&gt;
&lt;li&gt;By the end of the internship I hope to secure a remote frontend developer, javascript or fullstack developer job.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks at &lt;a href="https://zuri.team"&gt;zuri team&lt;/a&gt;, &lt;a href="https://internship.zuri.team"&gt;Zuri Internship&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Here are some awesome beginner's tutorials
&lt;/h4&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/FTFaQWZBqQ8"&gt;
&lt;/iframe&gt;
&lt;br&gt;
  &lt;a href="https://www.youtube.com/watch?v=FTFaQWZBqQ8"&gt;Figma tutorial&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/RGOj5yH7evk"&gt;
&lt;/iframe&gt;
&lt;br&gt;
   &lt;a href="https://www.youtube.com/watch?v=RGOj5yH7evk"&gt;Version Control with Git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/D-h8L5hgW-w"&gt;
&lt;/iframe&gt;
&lt;br&gt;
   &lt;a href="https://www.youtube.com/watch?v=D-h8L5hgW-w"&gt;Learning HTML and CSS&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/W6NZfCO5SIk"&gt;
&lt;/iframe&gt;
&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=W6NZfCO5SIk"&gt;Using Javascript&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Nothing Good comes easy.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>javascript</category>
      <category>frontend</category>
      <category>internship</category>
      <category>react</category>
    </item>
  </channel>
</rss>
