<?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: OneDev</title>
    <description>The latest articles on DEV Community by OneDev (@onedev).</description>
    <link>https://dev.to/onedev</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%2F2067402%2Fce0e4116-75a7-4044-a3b3-870c37cb32eb.png</url>
      <title>DEV Community: OneDev</title>
      <link>https://dev.to/onedev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/onedev"/>
    <language>en</language>
    <item>
      <title>🔁 Recursion — Think Smaller to Solve Bigger</title>
      <dc:creator>OneDev</dc:creator>
      <pubDate>Mon, 28 Jul 2025 20:53:44 +0000</pubDate>
      <link>https://dev.to/onedev/recursion-think-smaller-to-solve-bigger-38fo</link>
      <guid>https://dev.to/onedev/recursion-think-smaller-to-solve-bigger-38fo</guid>
      <description>&lt;p&gt;Recursion is when a function calls itself to solve a problem by breaking it down into smaller subproblems.&lt;/p&gt;

&lt;p&gt;It’s everywhere — from algorithms to UI rendering.&lt;/p&gt;

&lt;h2&gt;
  
  
  📦 Real-world examples:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;File system traversal&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DOM rendering in React&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tree/graph traversal&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backtracking problems&lt;/strong&gt; (e.g. Sudoku, N-Queens)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🧠 Key idea:
&lt;/h2&gt;

&lt;p&gt;Every recursive function should have:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A &lt;strong&gt;base case&lt;/strong&gt; — when to stop
&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;recursive case&lt;/strong&gt; — how to reduce the problem
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;countDown&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nf"&gt;countDown&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🚨 Gotchas:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Recursion can be elegant, but deep recursion may lead to stack overflow.&lt;/li&gt;
&lt;li&gt;Sometimes it's better to refactor to an iterative solution.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ⚡ TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Recursion helps solve problems by thinking in terms of subproblems.&lt;/li&gt;
&lt;li&gt;Just make sure it has a clear base case to avoid infinite loops.&lt;/li&gt;
&lt;li&gt;It's powerful, but use it wisely — especially with large inputs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💬 Want a post with real coding problems that use recursion? Let me know!&lt;/p&gt;

</description>
      <category>programming</category>
      <category>algorithms</category>
      <category>datastructures</category>
      <category>recursion</category>
    </item>
    <item>
      <title>The JavaScript Ternary Operator — Your New Best Friend for Clean Code 🚀</title>
      <dc:creator>OneDev</dc:creator>
      <pubDate>Tue, 15 Jul 2025 13:33:31 +0000</pubDate>
      <link>https://dev.to/onedev/the-javascript-ternary-operator-your-new-best-friend-for-clean-code-3coe</link>
      <guid>https://dev.to/onedev/the-javascript-ternary-operator-your-new-best-friend-for-clean-code-3coe</guid>
      <description>&lt;p&gt;If you’re still writing simple &lt;code&gt;if...else&lt;/code&gt; blocks like it’s 1999, let me introduce you to a little gem: the &lt;strong&gt;ternary operator&lt;/strong&gt;. It’s the fastest way to make your code cleaner, shorter, and yes—way cooler.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 What is it?
&lt;/h2&gt;

&lt;p&gt;Think of the ternary operator as a quick decision maker:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;condition&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;doThisIfTrue&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;doThatIfFalse&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It’s like asking your code: “Hey, is this true? If yes, do this. If no, do that.”&lt;/p&gt;

&lt;h2&gt;
  
  
  ✨ Why should you care?
&lt;/h2&gt;

&lt;p&gt;Because it saves you from writing bulky code like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isLoggedIn&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Welcome back!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Please log in.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead, just do this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;isLoggedIn&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Welcome back!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Please log in.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Boom! One line, same result.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔥 Real talk — when to use it?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;✅ Great for quick checks and simple assignments.&lt;/li&gt;
&lt;li&gt;✅ Perfect inside JSX for React components.&lt;/li&gt;
&lt;li&gt;⚠️ Avoid when logic gets complicated — readability &amp;gt; brevity!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  💡 Pro tip: Keep it simple!
&lt;/h2&gt;

&lt;p&gt;Nested ternaries are tempting but can turn your code into spaghetti:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;90&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;A&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;75&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;B&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;C&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use with care and add comments if needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✅ Challenge
&lt;/h2&gt;

&lt;p&gt;Replace your next simple &lt;code&gt;if...else&lt;/code&gt; with a ternary. See how much cleaner your code looks!&lt;br&gt;
Got a favorite ternary trick? Drop it below and let’s share the love 💙👇&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>development</category>
      <category>webdev</category>
    </item>
    <item>
      <title>What Is a Trie? The Data Structure Behind Autocomplete</title>
      <dc:creator>OneDev</dc:creator>
      <pubDate>Tue, 15 Jul 2025 11:00:00 +0000</pubDate>
      <link>https://dev.to/onedev/what-is-a-trie-the-data-structure-behind-autocomplete-i99</link>
      <guid>https://dev.to/onedev/what-is-a-trie-the-data-structure-behind-autocomplete-i99</guid>
      <description>&lt;p&gt;Ever wondered how search boxes suggest words as you type? Or how a spell checker knows what you probably meant to write?&lt;/p&gt;

&lt;p&gt;Behind the scenes, there's a powerful but often underrated data structure making it all possible: the &lt;strong&gt;Trie&lt;/strong&gt; (pronounced "try").&lt;/p&gt;

&lt;p&gt;Let’s take a look 👇&lt;/p&gt;




&lt;h2&gt;
  
  
  🔠 What Is a Trie?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;Trie&lt;/strong&gt;, also known as a &lt;strong&gt;prefix tree&lt;/strong&gt;, is a tree-like data structure used to store a dynamic set of strings — especially useful for &lt;strong&gt;prefix-based lookups&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Each node in a trie represents a character, and by connecting nodes from top to bottom, you can represent entire words.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 Real-World Use Cases
&lt;/h2&gt;

&lt;p&gt;Tries shine when you’re dealing with words, prefixes, or partial matches. You’ll find them behind:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Autocomplete and search suggestions&lt;/strong&gt;
(e.g. Google search, VSCode IntelliSense)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Spell checkers and correctors&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;IP routing (longest prefix matching)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Word games&lt;/strong&gt; like Boggle or Scrabble solvers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dictionary or keyword matching&lt;/strong&gt; systems&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔍 Why Not Just Use an Array or Hash Table?
&lt;/h2&gt;

&lt;p&gt;Let’s say you have a list of 100,000 words. If you want to find all words that start with &lt;code&gt;"cat"&lt;/code&gt;, a trie can do that &lt;strong&gt;faster and more efficiently&lt;/strong&gt; than scanning every word in an array or using a hash table.&lt;/p&gt;

&lt;p&gt;Why? Because the structure of a trie &lt;strong&gt;naturally groups words by their prefixes&lt;/strong&gt;, making lookups almost instantaneous.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚙️ How It Works (At a High Level)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Each node represents a single character.&lt;/li&gt;
&lt;li&gt;Children nodes represent possible next characters.&lt;/li&gt;
&lt;li&gt;Words are built by walking down from the root node.&lt;/li&gt;
&lt;li&gt;A special flag marks the end of a valid word.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example: Storing "cat" and "car"
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;        &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;root&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        &lt;span class="o"&gt;/&lt;/span&gt;   &lt;span class="err"&gt;\&lt;/span&gt;
      &lt;span class="nt"&gt;c&lt;/span&gt;     &lt;span class="o"&gt;...&lt;/span&gt;
      &lt;span class="o"&gt;|&lt;/span&gt;
      &lt;span class="nt"&gt;a&lt;/span&gt;
     &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;t&lt;/span&gt;   &lt;span class="nt"&gt;r&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From the root, &lt;code&gt;"c"&lt;/code&gt; leads to &lt;code&gt;"a"&lt;/code&gt;, which leads to &lt;code&gt;"t"&lt;/code&gt; or &lt;code&gt;"r"&lt;/code&gt; — forming "cat" and "car".&lt;/p&gt;




&lt;h2&gt;
  
  
  🚀 Benefits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fast prefix searches&lt;/strong&gt; (often O(k), where &lt;em&gt;k&lt;/em&gt; is the length of the word)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Efficient memory usage&lt;/strong&gt; for shared prefixes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flexible&lt;/strong&gt;: can be extended to support wildcard matching, autocomplete ranking, etc.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🤔 When to Reach for a Trie
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You’re implementing a feature based on &lt;strong&gt;prefix matching&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;You need to do &lt;strong&gt;lots of lookups&lt;/strong&gt; from a large dictionary of words&lt;/li&gt;
&lt;li&gt;You want to build something like autocomplete, spellcheck, or typeahead&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧠 TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;Trie&lt;/strong&gt; is a tree-like data structure designed for efficient &lt;strong&gt;prefix-based string matching&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;It powers real-world features like &lt;strong&gt;autocomplete&lt;/strong&gt;, &lt;strong&gt;search suggestions&lt;/strong&gt;, and &lt;strong&gt;spellcheckers&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;If you’re dealing with lots of strings and care about prefixes — &lt;strong&gt;Tries are worth knowing&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>algorithms</category>
      <category>datastructures</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>What Is a Heap in programming? And Why You’ve Probably Used One Without Knowing</title>
      <dc:creator>OneDev</dc:creator>
      <pubDate>Mon, 14 Jul 2025 21:38:30 +0000</pubDate>
      <link>https://dev.to/onedev/what-is-a-heap-and-why-youve-probably-used-one-without-knowing-44kb</link>
      <guid>https://dev.to/onedev/what-is-a-heap-and-why-youve-probably-used-one-without-knowing-44kb</guid>
      <description>&lt;p&gt;You might have heard the word &lt;strong&gt;"heap"&lt;/strong&gt; tossed around in computer science — usually in the same breath as &lt;strong&gt;priority queues&lt;/strong&gt; or sorting algorithms.&lt;/p&gt;

&lt;p&gt;But what exactly is a heap, and why should you care?&lt;/p&gt;

&lt;p&gt;Let’s break it down 👇&lt;/p&gt;




&lt;h2&gt;
  
  
  🧱 What is a Heap?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;heap&lt;/strong&gt; is a specialized tree-based data structure that satisfies the &lt;strong&gt;heap property&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In a &lt;strong&gt;max heap&lt;/strong&gt;, every parent node is &lt;strong&gt;greater than or equal to&lt;/strong&gt; its children.&lt;/li&gt;
&lt;li&gt;In a &lt;strong&gt;min heap&lt;/strong&gt;, every parent node is &lt;strong&gt;less than or equal to&lt;/strong&gt; its children.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This structure lets you quickly access the &lt;strong&gt;maximum&lt;/strong&gt; (or &lt;strong&gt;minimum&lt;/strong&gt;) value — which is always right at the top.&lt;/p&gt;

&lt;p&gt;Think of it as a "semi-sorted" tree optimized for fast access to the most important item.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 Real-World Use Cases
&lt;/h2&gt;

&lt;p&gt;Here’s where heaps come in handy — and where you’ve probably been using one under the hood:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Priority Queues&lt;/strong&gt; – When tasks are ordered by importance (e.g. CPU scheduling, print queues, A* pathfinding).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Heapsort Algorithm&lt;/strong&gt; – A comparison-based sorting algorithm built on heap structures.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dijkstra’s Algorithm&lt;/strong&gt; – Used in Google Maps and GPS apps to find the shortest path.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Top-K Problems&lt;/strong&gt; – Finding the top 5 trending posts, best scores, or cheapest prices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Event Scheduling&lt;/strong&gt; – Managing time-based triggers in simulations or games.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even if you haven’t written a heap yourself, if you’ve used a &lt;strong&gt;priority queue&lt;/strong&gt; in a language like Java, Python, or C++, you’ve likely worked with a heap already.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚙️ How Does a Heap Work?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It’s &lt;strong&gt;not&lt;/strong&gt; a fully sorted structure.&lt;/li&gt;
&lt;li&gt;It’s usually implemented as an &lt;strong&gt;array&lt;/strong&gt;, not a fancy tree in memory.&lt;/li&gt;
&lt;li&gt;You can insert an item in &lt;strong&gt;O(log n)&lt;/strong&gt; time.&lt;/li&gt;
&lt;li&gt;You can remove the top item in &lt;strong&gt;O(log n)&lt;/strong&gt; time.&lt;/li&gt;
&lt;li&gt;You can peek at the top in &lt;strong&gt;O(1)&lt;/strong&gt; time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pretty efficient, right?&lt;/p&gt;




&lt;h2&gt;
  
  
  💬 Why It’s Worth Knowing
&lt;/h2&gt;

&lt;p&gt;You don’t need heaps every day — but when you do, they solve specific problems &lt;strong&gt;extremely well&lt;/strong&gt;. They shine when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You only care about the &lt;em&gt;largest&lt;/em&gt; or &lt;em&gt;smallest&lt;/em&gt; item at any time.&lt;/li&gt;
&lt;li&gt;You’re dealing with tasks that need to be prioritized.&lt;/li&gt;
&lt;li&gt;You want to keep track of the top &lt;code&gt;k&lt;/code&gt; results without sorting the entire dataset.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔚 TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;heap&lt;/strong&gt; is a tree-based structure that helps you quickly access the min or max element.&lt;/li&gt;
&lt;li&gt;It’s the backbone of &lt;strong&gt;priority queues&lt;/strong&gt;, &lt;strong&gt;heapsort&lt;/strong&gt;, and &lt;strong&gt;shortest path algorithms&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You’ve probably used one without even knowing it — and now you do. 💡&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>algorithms</category>
      <category>datastructures</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Make requests to your API through AI 👇</title>
      <dc:creator>OneDev</dc:creator>
      <pubDate>Mon, 30 Jun 2025 23:35:30 +0000</pubDate>
      <link>https://dev.to/onedev/make-requests-to-your-api-through-ai-3h5m</link>
      <guid>https://dev.to/onedev/make-requests-to-your-api-through-ai-3h5m</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/onedev/build-ai-driven-api-requests-in-your-react-app-with-natural-language-5d8m" class="crayons-story__hidden-navigation-link"&gt;Build AI-Driven API Requests in Your React App — With Natural Language&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/onedev" class="crayons-avatar  crayons-avatar--l  "&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%2Fuser%2Fprofile_image%2F2067402%2Fce0e4116-75a7-4044-a3b3-870c37cb32eb.png" alt="onedev profile" class="crayons-avatar__image"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/onedev" class="crayons-story__secondary fw-medium m:hidden"&gt;
              OneDev
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                OneDev
                
              
              &lt;div id="story-author-preview-content-2621710" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/onedev" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&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%2Fuser%2Fprofile_image%2F2067402%2Fce0e4116-75a7-4044-a3b3-870c37cb32eb.png" class="crayons-avatar__image" alt=""&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;OneDev&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/onedev/build-ai-driven-api-requests-in-your-react-app-with-natural-language-5d8m" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Jun 24 '25&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/onedev/build-ai-driven-api-requests-in-your-react-app-with-natural-language-5d8m" id="article-link-2621710"&gt;
          Build AI-Driven API Requests in Your React App — With Natural Language
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/react"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;react&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/ai"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;ai&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/gemini"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;gemini&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/webdev"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;webdev&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
            &lt;a href="https://dev.to/onedev/build-ai-driven-api-requests-in-your-react-app-with-natural-language-5d8m#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              Comments


              &lt;span class="hidden s:inline"&gt;Add Comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            1 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
      <category>react</category>
      <category>ai</category>
      <category>gemini</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Trees &amp; Graphs Explained Simply — With Real-World Examples</title>
      <dc:creator>OneDev</dc:creator>
      <pubDate>Mon, 30 Jun 2025 20:14:22 +0000</pubDate>
      <link>https://dev.to/onedev/trees-graphs-explained-simply-with-real-world-examples-4n76</link>
      <guid>https://dev.to/onedev/trees-graphs-explained-simply-with-real-world-examples-4n76</guid>
      <description>&lt;p&gt;If you're learning data structures, you've probably heard that &lt;strong&gt;trees and graphs&lt;/strong&gt; are “advanced” — but the truth is, they show up everywhere, and you’ve likely been using them without even realizing it.&lt;/p&gt;

&lt;p&gt;Let’s break them down simply — with &lt;strong&gt;real-world use cases that are actually used in practice&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  🌳 Trees — Hierarchies Made Simple
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;tree&lt;/strong&gt; is a special kind of graph with a clear hierarchy. Think of it as a top-down structure where each item (called a node) can have children — but only one parent.&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%2F7ugw1aa3qfq6tgqynovq.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%2F7ugw1aa3qfq6tgqynovq.png" alt="Tree example" width="456" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  🧠 Real-World Examples (Yes, these are real!)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;File systems&lt;/strong&gt;: Most operating systems organize files as a tree:
&lt;code&gt;/root → Documents → Project → File.txt&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTML DOM&lt;/strong&gt;: The browser uses a tree to structure the HTML of a page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Company org charts&lt;/strong&gt;: HR tools represent reporting lines using trees.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UI component trees&lt;/strong&gt;: Frameworks like React render your UI using nested component trees.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Syntax trees&lt;/strong&gt;: Compilers, linters, and bundlers use abstract syntax trees (ASTs) to parse and analyze code.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔗 Graphs — Flexible Connections
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;graph&lt;/strong&gt; is a more general structure where nodes can connect to any number of other nodes — in any direction. Great for modeling networks and relationships.&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%2Fogbf0ez0b6alqez560fu.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%2Fogbf0ez0b6alqez560fu.png" alt="Graphs examples" width="424" height="194"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  🧠 Real-World Examples (Also real and widely used)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Social networks&lt;/strong&gt;: Facebook, Twitter, and LinkedIn are built on user connection graphs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Maps and GPS&lt;/strong&gt;: Locations are nodes, and roads are edges — this powers Google Maps and Waze.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recommendation systems&lt;/strong&gt;: Netflix and Amazon use graph models to suggest related content or products.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Web crawling&lt;/strong&gt;: Search engines crawl the web as a graph of pages and links.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dependency graphs&lt;/strong&gt;: Tools like npm, Webpack, and Babel use graphs to track dependencies between files or modules.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧩 Tree vs Graph — What's the Difference?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Tree&lt;/th&gt;
&lt;th&gt;Graph&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Structure&lt;/td&gt;
&lt;td&gt;Hierarchical (no cycles)&lt;/td&gt;
&lt;td&gt;Network (can have cycles)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Parent per node&lt;/td&gt;
&lt;td&gt;Only one&lt;/td&gt;
&lt;td&gt;Can have many&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Common use case&lt;/td&gt;
&lt;td&gt;Nested data&lt;/td&gt;
&lt;td&gt;Connected data&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A &lt;strong&gt;tree is a type of graph&lt;/strong&gt;, but not all graphs are trees.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Trees and graphs are &lt;strong&gt;not just theoretical&lt;/strong&gt; — they're used in real systems you interact with daily.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trees&lt;/strong&gt; model hierarchical relationships — like folders, DOM elements, or organizational charts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Graphs&lt;/strong&gt; model connections and networks — like social media, maps, recommendations, and web pages.&lt;/li&gt;
&lt;li&gt;Just knowing how to recognize them helps you make sense of data structures in your code and APIs.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Let me know if you’d like a follow-up post with code examples or how to actually work with these in JavaScript, Python, or Java! 🚀&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>datastructures</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Build AI-Driven API Requests in Your React App — With Natural Language</title>
      <dc:creator>OneDev</dc:creator>
      <pubDate>Tue, 24 Jun 2025 18:25:27 +0000</pubDate>
      <link>https://dev.to/onedev/build-ai-driven-api-requests-in-your-react-app-with-natural-language-5d8m</link>
      <guid>https://dev.to/onedev/build-ai-driven-api-requests-in-your-react-app-with-natural-language-5d8m</guid>
      <description>&lt;p&gt;What if you could skip forms entirely and just &lt;em&gt;tell&lt;/em&gt; your app what to do?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://youtu.be/BpW0ewfYazI" rel="noopener noreferrer"&gt;In this video&lt;/a&gt;, I show you how to integrate AI into a React app to &lt;strong&gt;generate API request payloads using natural language&lt;/strong&gt; — even with voice input.&lt;/p&gt;

&lt;p&gt;Instead of filling out a form to create a user, imagine typing or saying:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Create a user with the email &lt;a href="mailto:example@gmail.com"&gt;example@gmail.com&lt;/a&gt;, who is 30 years old, with phone number 123456, and password ABCDEF.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The AI takes this prompt and converts it into a proper JSON payload — and &lt;strong&gt;your app&lt;/strong&gt; then sends it to the API, just like a traditional form would.&lt;/p&gt;

&lt;p&gt;We’ll walk through it step by step:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sending text prompts to a GenAI model&lt;/li&gt;
&lt;li&gt;Recording voice input and transcribing it to text&lt;/li&gt;
&lt;li&gt;Parsing the result into JSON and making the POST request&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;💡 You’ll end up with a hands-free, natural language interface for your backend — a whole new way to think about user input.&lt;/p&gt;

&lt;p&gt;🎥 &lt;strong&gt;Watch the full tutorial here:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
👉 &lt;a href="https://youtu.be/BpW0ewfYazI" rel="noopener noreferrer"&gt;YouTube Video Link&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Let me know what you think — and if you'd like to see more voice + AI experiments in future videos!&lt;/p&gt;

</description>
      <category>react</category>
      <category>ai</category>
      <category>gemini</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Stop Typing Interfaces Manually — This VSCode Extension Does It for You</title>
      <dc:creator>OneDev</dc:creator>
      <pubDate>Fri, 06 Jun 2025 19:09:06 +0000</pubDate>
      <link>https://dev.to/onedev/stop-typing-interfaces-manually-this-vscode-extension-does-it-for-you-1p8a</link>
      <guid>https://dev.to/onedev/stop-typing-interfaces-manually-this-vscode-extension-does-it-for-you-1p8a</guid>
      <description>&lt;p&gt;Tired of writing TypeScript interfaces or objects by hand from JSON?&lt;/p&gt;

&lt;p&gt;🧩 &lt;a href="https://marketplace.visualstudio.com/items?itemName=quicktype.quicktype" rel="noopener noreferrer"&gt;&lt;strong&gt;Paste JSON as Code&lt;/strong&gt;&lt;/a&gt; is a VSCode extension that does it for you — instantly.&lt;/p&gt;

&lt;p&gt;Just copy your JSON → open the Command Palette → select &lt;code&gt;Paste JSON as Code&lt;/code&gt; → pick your language → done.&lt;/p&gt;

&lt;p&gt;Supports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TypeScript&lt;/li&gt;
&lt;li&gt;JavaScript&lt;/li&gt;
&lt;li&gt;C#&lt;/li&gt;
&lt;li&gt;Go&lt;/li&gt;
&lt;li&gt;And more&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🔗 &lt;a href="https://marketplace.visualstudio.com/items?itemName=quicktype.quicktype" rel="noopener noreferrer"&gt;Get it on the VSCode Marketplace&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Try it once — it might just become part of your daily workflow.&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>productivity</category>
      <category>typescript</category>
      <category>tooling</category>
    </item>
    <item>
      <title>Handling Permissions in React Native 🚀</title>
      <dc:creator>OneDev</dc:creator>
      <pubDate>Fri, 06 Jun 2025 18:58:09 +0000</pubDate>
      <link>https://dev.to/onedev/handling-permissions-in-react-native-399f</link>
      <guid>https://dev.to/onedev/handling-permissions-in-react-native-399f</guid>
      <description>&lt;p&gt;Working with &lt;strong&gt;camera&lt;/strong&gt;, &lt;strong&gt;location&lt;/strong&gt;, or &lt;strong&gt;microphone access&lt;/strong&gt; in React Native? 📲&lt;br&gt;
Then you’ve probably run into permission headaches on iOS and Android.&lt;/p&gt;

&lt;p&gt;I just dropped a new video where I cover how to &lt;strong&gt;check, request, and manage permissions&lt;/strong&gt; using &lt;code&gt;react-native-permissions&lt;/code&gt; — one of the most reliable libraries for this task.&lt;/p&gt;

&lt;h4&gt;
  
  
  🎥 What’s inside the video?
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Overview of how mobile permissions work&lt;/li&gt;
&lt;li&gt;Setting up the react-native-permissions library&lt;/li&gt;
&lt;li&gt;Checking and requesting permissions cleanly&lt;/li&gt;
&lt;li&gt;Dealing with blocked permissions using openSettings&lt;/li&gt;
&lt;li&gt;A real-world example: requesting camera access&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://youtu.be/ZQzcVY3CoFQ" rel="noopener noreferrer"&gt;🔗 Watch the full video here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;📦 I’ve also shared the full codebase on GitHub so you can follow along easily.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/francoangulo/permissions-tutorial" rel="noopener noreferrer"&gt;🔗 GitHub Repo&lt;/a&gt;&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>programming</category>
      <category>javascript</category>
      <category>mobile</category>
    </item>
    <item>
      <title>Make sure to understand this before starting with NextJS 👇</title>
      <dc:creator>OneDev</dc:creator>
      <pubDate>Mon, 02 Jun 2025 21:13:57 +0000</pubDate>
      <link>https://dev.to/onedev/make-sure-to-understand-this-before-starting-with-nextjs-423f</link>
      <guid>https://dev.to/onedev/make-sure-to-understand-this-before-starting-with-nextjs-423f</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/onedev/nextjs-pages-router-vs-app-router-whats-the-difference-202c" class="crayons-story__hidden-navigation-link"&gt;Next.js Pages Router vs App Router — What’s the Difference?&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/onedev" class="crayons-avatar  crayons-avatar--l  "&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%2Fuser%2Fprofile_image%2F2067402%2Fce0e4116-75a7-4044-a3b3-870c37cb32eb.png" alt="onedev profile" class="crayons-avatar__image"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/onedev" class="crayons-story__secondary fw-medium m:hidden"&gt;
              OneDev
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                OneDev
                
              
              &lt;div id="story-author-preview-content-2425496" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/onedev" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&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%2Fuser%2Fprofile_image%2F2067402%2Fce0e4116-75a7-4044-a3b3-870c37cb32eb.png" class="crayons-avatar__image" alt=""&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;OneDev&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/onedev/nextjs-pages-router-vs-app-router-whats-the-difference-202c" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Apr 22 '25&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/onedev/nextjs-pages-router-vs-app-router-whats-the-difference-202c" id="article-link-2425496"&gt;
          Next.js Pages Router vs App Router — What’s the Difference?
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/nextjs"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;nextjs&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/react"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;react&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/javascript"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;javascript&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/webdev"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;webdev&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
            &lt;a href="https://dev.to/onedev/nextjs-pages-router-vs-app-router-whats-the-difference-202c#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              Comments


              &lt;span class="hidden s:inline"&gt;Add Comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            2 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
      <category>nextjs</category>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>📦 Stacks &amp; Queues: Two Sides of the Same Coin</title>
      <dc:creator>OneDev</dc:creator>
      <pubDate>Mon, 02 Jun 2025 15:00:00 +0000</pubDate>
      <link>https://dev.to/onedev/stacks-queues-two-sides-of-the-same-coin-2nfh</link>
      <guid>https://dev.to/onedev/stacks-queues-two-sides-of-the-same-coin-2nfh</guid>
      <description>&lt;p&gt;When it comes to data structures, &lt;strong&gt;Stacks&lt;/strong&gt; and &lt;strong&gt;Queues&lt;/strong&gt; are two of the simplest — and most powerful — tools in your problem-solving toolkit.&lt;/p&gt;

&lt;p&gt;They're like the behind-the-scenes stagehands that quietly manage order, timing, and flow in countless algorithms and real-world systems.&lt;/p&gt;

&lt;p&gt;Let’s take a look.&lt;/p&gt;




&lt;h2&gt;
  
  
  🥞 Stack — Last In, First Out (LIFO)
&lt;/h2&gt;

&lt;p&gt;Imagine a stack of plates. You can only take the top plate off the stack, and you can only add new ones to the top.&lt;/p&gt;

&lt;p&gt;That’s how a &lt;strong&gt;Stack&lt;/strong&gt; works:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Push&lt;/strong&gt; → add to the top&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pop&lt;/strong&gt; → remove from the top&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Peek&lt;/strong&gt; → look at the top without removing it&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Real-world examples:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Undo/Redo functionality&lt;/li&gt;
&lt;li&gt;Navigation History (Browser or App Screens)&lt;/li&gt;
&lt;li&gt;Expression Evaluation &amp;amp; Parsing&lt;/li&gt;
&lt;li&gt;Backtracking Algorithms&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example in React Native Context
&lt;/h4&gt;

&lt;p&gt;React Navigation’s stack navigator (screen navigation stack)&lt;/p&gt;

&lt;h3&gt;
  
  
  Code Example (JavaScript):
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;stack&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
&lt;span class="nx"&gt;stack&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;stack&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;stack&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;// 2&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;stack&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;// 1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🚶 Queue — First In, First Out (FIFO)
&lt;/h2&gt;

&lt;p&gt;Now picture a line at the coffee shop. The first person to enter is the first one to get served.&lt;/p&gt;

&lt;p&gt;That’s the idea of a &lt;strong&gt;Queue&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Enqueue&lt;/strong&gt; → add to the end&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dequeue&lt;/strong&gt; → remove from the front&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Peek&lt;/strong&gt; → look at the front without removing&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Real-world examples:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Task scheduling&lt;/li&gt;
&lt;li&gt;Message Queues&lt;/li&gt;
&lt;li&gt;Print Queue&lt;/li&gt;
&lt;li&gt;Event Handling (UI events like clicks or keystrokes)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example in React Native Context:
&lt;/h4&gt;

&lt;p&gt;Offline message sending queue in a chat app — messages are queued if the user is offline, then sent one by one when connection is restored&lt;/p&gt;

&lt;h3&gt;
  
  
  Code Example (JavaScript):
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;queue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
&lt;span class="nx"&gt;queue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;A&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;queue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;B&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;queue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;shift&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;// 'A'&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;queue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;shift&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;// 'B'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🔁 Same Concept, Different Languages
&lt;/h2&gt;

&lt;p&gt;While the concept of stacks and queues remains consistent, each programming language has its own way of implementing them:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Language&lt;/th&gt;
&lt;th&gt;Stack&lt;/th&gt;
&lt;th&gt;Queue&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;JavaScript&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Array.push()&lt;/code&gt; / &lt;code&gt;.pop()&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Array.push()&lt;/code&gt; / &lt;code&gt;.shift()&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Python&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;list&lt;/code&gt;, &lt;code&gt;collections.deque&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;collections.deque&lt;/code&gt;, &lt;code&gt;queue.Queue&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Java&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Stack&lt;/code&gt;, &lt;code&gt;Deque&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Queue&lt;/code&gt;, &lt;code&gt;LinkedList&lt;/code&gt;, &lt;code&gt;PriorityQueue&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;✅ &lt;strong&gt;Java&lt;/strong&gt; provides dedicated, type-safe classes out of the box — ideal for enterprise-scale apps.&lt;/p&gt;

&lt;p&gt;⚡ &lt;strong&gt;Python&lt;/strong&gt; hits the sweet spot with easy syntax and optimized utilities like &lt;code&gt;deque&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;🧪 &lt;strong&gt;JavaScript&lt;/strong&gt; keeps it simple — arrays get the job done, but aren’t true queues or stacks under the hood.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;👉 If you want to know how to create proper stacks and queues in JavaScript step by step, let me know in the comments — happy to make a follow-up!&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Stacks = LIFO (Last In, First Out)&lt;/li&gt;
&lt;li&gt;Queues = FIFO (First In, First Out)&lt;/li&gt;
&lt;li&gt;They're used everywhere, from compilers to servers&lt;/li&gt;
&lt;li&gt;You can implement both using arrays, but some languages give you more powerful tools&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  ✌️ That’s a Wrap!
&lt;/h3&gt;

&lt;p&gt;These might be simple structures, but don’t underestimate them. They’re building blocks for everything from graph traversals to memory management.&lt;/p&gt;

&lt;p&gt;Got questions or want a deeper dive into how they’re used in algorithms? Drop a comment!&lt;/p&gt;

</description>
      <category>datastructures</category>
      <category>algorithms</category>
      <category>performance</category>
      <category>programming</category>
    </item>
    <item>
      <title>Linked Lists — A Core Building Block in Data Structures</title>
      <dc:creator>OneDev</dc:creator>
      <pubDate>Thu, 22 May 2025 16:00:00 +0000</pubDate>
      <link>https://dev.to/onedev/linked-lists-a-core-building-block-in-data-structures-k2d</link>
      <guid>https://dev.to/onedev/linked-lists-a-core-building-block-in-data-structures-k2d</guid>
      <description>&lt;p&gt;Arrays usually get all the love. They're easy to use, built into every language, and great for most tasks.&lt;/p&gt;

&lt;p&gt;But there’s another data structure that quietly powers a lot of efficient solutions: the linked list.&lt;/p&gt;

&lt;p&gt;It’s not about speed for direct access — it’s about flexibility, efficient insertions, and being the foundation for structures like stacks, queues, and even graphs.&lt;/p&gt;

&lt;p&gt;Let’s give it the spotlight it deserves.&lt;/p&gt;




&lt;h2&gt;
  
  
  🤔 What Is a Linked List?
&lt;/h2&gt;

&lt;p&gt;A linked list is a linear data structure made up of nodes.&lt;br&gt;
Each node holds:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;value&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;reference (or pointer)&lt;/strong&gt; to the next node&lt;/li&gt;
&lt;/ul&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%2Fmemfkvzznh2tew5tbsd7.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%2Fmemfkvzznh2tew5tbsd7.png" alt="Linked List illustration" width="800" height="217"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A simple representation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unlike arrays, elements in a linked list are not stored in contiguous memory. This makes linked lists:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;More memory flexible&lt;/li&gt;
&lt;li&gt;Ideal for fast insertions and deletions&lt;/li&gt;
&lt;li&gt;Slower for direct access to elements by index&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🛠️ Use Cases: When Are Linked Lists Useful?
&lt;/h2&gt;

&lt;p&gt;Use a linked list when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need &lt;strong&gt;dynamic memory allocation&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;You perform &lt;strong&gt;frequent insertions/deletions&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;You don't require constant-time random access (&lt;code&gt;O(1)&lt;/code&gt; index lookup)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some real-world applications:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Undo/redo functionality in editors&lt;/li&gt;
&lt;li&gt;Browser history&lt;/li&gt;
&lt;li&gt;Queues and stacks&lt;/li&gt;
&lt;li&gt;Hash table chaining (collision resolution)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🧠 Types of Linked Lists
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Singly Linked List&lt;/strong&gt; – Each node points to the next&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Doubly Linked List&lt;/strong&gt; – Each node points to both next and previous&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Circular Linked List&lt;/strong&gt; – Last node points back to the first node&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🧪 Let’s Build a Simple Linked List in JavaScript
&lt;/h2&gt;

&lt;p&gt;Here’s a minimal implementation of a &lt;strong&gt;singly linked list&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Each node in the linked list holds a value and a pointer to the next node&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Node&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Store the actual data&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   &lt;span class="c1"&gt;// Pointer to the next node (default: null)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// LinkedList class manages the overall list&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LinkedList&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Start with an empty list&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Adds a new node at the end of the list&lt;/span&gt;
  &lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newNode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Node&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// If list is empty, set head to the new node&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;newNode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Otherwise, traverse to the end of the list&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Link the last node to the new node&lt;/span&gt;
    &lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;newNode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Prints out the list in a readable format&lt;/span&gt;
  &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;head&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Traverse and build the output string&lt;/span&gt;
    &lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;output&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s2"&gt;`[&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;] → `&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nx"&gt;output&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;null&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// End of the list&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;output&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Example usage&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;LinkedList&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Output: [10] → [20] → [30] → null&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  ⏱️ Time Complexity Overview
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operation&lt;/th&gt;
&lt;th&gt;Time Complexity&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Insert at Head&lt;/td&gt;
&lt;td&gt;O(1)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Insert at Tail&lt;/td&gt;
&lt;td&gt;O(n)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Search&lt;/td&gt;
&lt;td&gt;O(n)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Delete Node&lt;/td&gt;
&lt;td&gt;O(n)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Access by Index&lt;/td&gt;
&lt;td&gt;O(n)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  ⚖️ Pros &amp;amp; Cons
&lt;/h2&gt;

&lt;h3&gt;
  
  
  ✅ Pros:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Efficient insertions/deletions&lt;/li&gt;
&lt;li&gt;Dynamic memory use (no resizing)&lt;/li&gt;
&lt;li&gt;Great for stacks, queues, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ❌ Cons:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Slower access time (O(n) for index)&lt;/li&gt;
&lt;li&gt;Uses extra memory (pointers)&lt;/li&gt;
&lt;li&gt;More complex to implement than arrays&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧵 TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A Linked List is a dynamic, node-based data structure.&lt;/li&gt;
&lt;li&gt;It’s ideal when you don’t know the final size of your collection.&lt;/li&gt;
&lt;li&gt;Although not as fast for access, it excels in insertions and deletions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;It lays the foundation for many advanced data structures.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Thanks for reading! 🙌
&lt;/h3&gt;

&lt;p&gt;If you're enjoying the series, feel free to follow me here or check out &lt;a href="https://www.youtube.com/channel/UCCKl7vIn451xiq2FEMW1Q1Q" rel="noopener noreferrer"&gt;my YouTube channel&lt;/a&gt; for more hands-on dev content.&lt;/p&gt;

</description>
      <category>datastructures</category>
      <category>algorithms</category>
      <category>javascript</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
