<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[TheCodingWay - Medium]]></title>
        <description><![CDATA[Dive into the fascinating world of coding with our publication, “TheCodingWay”. Explore a diverse range of topics, from algorithm optimization to best practices in software development. Whether you’re a seasoned developer or just starting your coding journey, you are covered. - Medium]]></description>
        <link>https://medium.com/thecodingway?source=rss----4f9044803049---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>TheCodingWay - Medium</title>
            <link>https://medium.com/thecodingway?source=rss----4f9044803049---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 12 Nov 2026 23:38:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/thecodingway" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Your Vector Database Isn’t Magic — It’s Just Really Good at Shortcuts]]></title>
            <link>https://medium.com/thecodingway/your-vector-database-isnt-magic-it-s-just-really-good-at-shortcuts-f3a4624f15c0?source=rss----4f9044803049---4</link>
            <guid isPermaLink="false">https://medium.com/p/f3a4624f15c0</guid>
            <category><![CDATA[agentic-rag]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[hnsw]]></category>
            <dc:creator><![CDATA[Akhil Kumar]]></dc:creator>
            <pubDate>Thu, 16 Jul 2026 17:35:17 GMT</pubDate>
            <atom:updated>2026-07-16T17:35:41.192Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Why Chroma’s HNSW index feels instant (and when it quietly lies to you)</strong></p><p><em>~12 min read · ChromaDB · Vector Search · RAG · Python</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sfQ2uSOIZiKnxJ2S" /></figure><p><em>Photo by </em><a href="https://unsplash.com/photos/Q1p7bh3SHj8"><em>NASA</em></a><em> on Unsplash</em></p><p>You type a messy question into a RAG app.<br> Something like: <em>“stuff about cute animals that climb trees.”</em></p><p>Half a second later, the right paragraphs show up — even though none of them contain those exact words.</p><p>That moment feels like magic. It isn’t.</p><p>Under the hood, your query became a vector. Every document became a vector. Then a graph-based index — <strong>HNSW</strong> — took a series of smart shortcuts through high-dimensional space to find “near” instead of “identical.”</p><p>Chroma DB makes this look almost too easy. One collection.query() and you&#39;re done. The danger is that easy APIs hide the interesting part: <strong>why</strong> search is fast, <strong>where</strong> it can fail, and <strong>which knobs</strong> actually matter when you leave the toy dataset behind.</p><p>Let’s pull the curtain back — with a tiny, slightly evil example involving pandas (the animals) and pandas (the library). Spoiler: one of them will try to steal the spotlight from a polar bear.</p><p>Cosine similarity is not mysterious. Normalize two vectors. Dot them. Bigger score → more similar. Congrats — you just reinvented semantic search… for a spreadsheet with 40 rows.</p><p>Now do that against <strong>10 million</strong> embeddings on every user query.</p><p>That’s not “slow.” That’s “your product demo dies during the pitch.”</p><p>A <strong>vector index</strong> exists for one reason: so the engine doesn’t have to shake hands with every vector in the room. It rearranges the embedding space into a structure that says, <em>“Ignore that entire neighborhood. This pocket looks promising.”</em></p><p>Think of it less like a sorted list and more like a city map with highways:</p><ul><li>Highways get you close fast.</li><li>Side streets finish the job.</li></ul><p>That highway system, in Chroma, is HNSW.</p><p><strong>Hierarchical Navigable Small World</strong> sounds like a research paper title that escaped the lab. The idea is surprisingly human.</p><p>Imagine every embedding is a person. Similar people know each other. A few well-connected people also know people across distant neighborhoods. That’s the “small world” part — you can reach almost anyone in a handful of introductions.</p><p>HNSW stacks that idea into <strong>layers</strong>:</p><p>Search starts high and greedily walks toward the query. When it can’t get closer on the current floor, it drops down a level and continues. By the time it reaches the ground floor, it’s already standing in the right zip code.</p><p>That’s why ANN (approximate nearest neighbor) search feels instant: it skips most of the dataset on purpose. “Approximate” doesn’t mean “sloppy.” It means <em>good enough, ridiculously fast</em> — and with the right settings, often indistinguishable from exact search.</p><blockquote><em>Want to </em>see<em> the layers move? These two explainers are worth a coffee break: </em><a href="https://cfu288.com/blog/2024-05_visual-guide-to-hnsw/"><em>Visual Guide to HNSW</em></a><em> · </em><a href="https://www.mongodb.com/resources/basics/hierarchical-navigable-small-world"><em>MongoDB on HNSW</em></a></blockquote><p><strong>Why teams keep choosing it</strong></p><ul><li>Fast enough for interactive apps</li><li>Accurate enough for production RAG</li><li>Scales from laptop demos to serious corpora</li><li>Plays nice with common distance metrics</li></ul><p>And in Chroma? It’s not one option among many. <strong>HNSW is the index.</strong> So learning its dials is not optional trivia — it’s part of using Chroma well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LMh6fI5gOvILKBbV.png" /></figure><p><em>Save this: brute force vs index, HNSW layers, Chroma knobs, and the filter seatbelt — one sheet.</em></p><p>Here’s the part most tutorials whisper past: HNSW quality is decided twice — once when you <strong>build</strong> the graph, and again when you <strong>query</strong> it.</p><p><strong>space</strong> - your definition of &quot;close.&quot;</p><ul><li>cosine → direction matters (great for text embeddings)</li><li>l2 → Euclidean distance (Chroma&#39;s default if you don&#39;t choose)</li><li>ip → inner product</li></ul><p>Pick this based on your embedding model’s assumptions. Don’t mix vibes.</p><p>- query-time “how hard should I look?”<br> Bigger candidate list → better recall, slower queries. This is your live tradeoff dial. Feeling shaky results in prod? Nudge this up before you rewrite your whole pipeline.</p><p><strong>ef_construction</strong> - build-time &quot;how careful should neighbor selection be?&quot;<br> Higher → richer graph, better long-term search quality, slower + hungrier indexing.</p><p><strong>max_neighbors</strong> - how social each node is allowed to be.<br> More edges → denser highways → often better navigation... and a fatter index in memory.</p><p>Mental model:</p><blockquote><em>ef_construction + </em><em>max_neighbors = </em><strong><em>quality of the map you draw</em></strong><em><br></em><em>ef_search = </em><strong><em>how thoroughly you read that map on each trip</em></strong></blockquote><p>A gorgeous map still fails if you only glance at it. A mediocre map can look fine if you stare hard enough. Tune both — don’t worship defaults forever.</p><p>We’re going to poison (lovingly) a tiny collection with the word <strong>pandas</strong> used two different ways:</p><p>Same token. Different universe.<br> If semantic search can’t tell a bamboo-eating bear from a DataFrame, your RAG app is about to recommend df.head() to zookeepers.</p><p>Yes, n_results=10 on a 4-document collection is overkill. That&#39;s intentional - we want the full ranking, not a polite top-1.</p><p>Rough shape of the response:</p><p>Look at that order. The animal docs win. The library docs lose.</p><p>Why does “cats” surface “cute pandas” first? Because embeddings don’t keyword-match — they cluster <em>vibes</em>. Cats → animals → cuteness sits nearer in vector space than cats → DataFrames. That’s the whole pitch of semantic search in one tiny leaderboard.</p><p>So far, the system looks brilliant.</p><p>Now let’s trip it.</p><p>What you might hope for: the mountain-bear sentence.<br> What you can get instead:</p><pre>{ &quot;ids&quot;: [[&quot;id4&quot;]], &quot;documents&quot;: [[ &quot;A direct comparison between pandas and polars indicates that polars is a more efficient library than pandas.&quot; ]], &quot;metadatas&quot;: [[{&quot;topic&quot;: &quot;data analysis&quot;}]], &quot;distances&quot;: [[0.624]] }</pre><p>There it is. The plot twist.</p><p>The model latched onto <strong>polar ≈ polars</strong> — a lexical lookalike wearing a data-engineering costume — and confidently handed you the wrong universe. This isn’t Chroma “being broken.” It’s a reminder:</p><blockquote><em>Vector search retrieves </em>nearest embeddings<em>, not </em>your intention<em>.</em></blockquote><p>Intent is a product problem. You solve it with better queries, better models, <strong>and</strong> (the underrated move) <strong>constraints</strong>.</p><p>Suddenly you’re only searching the animal shelf:</p><pre>{ &quot;ids&quot;: [[&quot;id1&quot;]], &quot;documents&quot;: [[ &quot;Giant pandas are a bear species that lives in mountainous areas.&quot; ]], &quot;distances&quot;: [[0.710]] }</pre><p>Same query. Different aisle. Correct answer.</p><p>You’re telling Chroma: “Semantic search is fine — just don’t even consider docs that scream ‘this is software.’”</p><p>In production RAG, this combo is gold: embeddings for <em>meaning</em>, filters for <em>business rules</em> (tenant, language, doc type, ACL, product line). Pure vector search is a brilliant intern. Filters are the manager who says “we’re not answering from the staging docs.”</p><p>Results are “almost right” but miss obvious hits</p><p>Raise ef_search</p><p>Index build is slow / RAM hungry</p><p>Lower ef_construction or max_neighbors</p><p>Queries are sharp on demos, mushy at scale</p><p>Rebuild with higher construction quality, then re-test ef_search</p><p>Semantic matches cross domains you hate</p><p>Add metadata early; filter aggressively</p><p>One token keeps hijacking meaning ( polars, brand names, acronyms)</p><p>Combine filters + better chunking + maybe a stronger embedding model</p><p>Don’t tune all four knobs on Friday night before a launch. Change one variable. Measure recall on a tiny golden set. Repeat. Boring? Yes. Also how good systems get good.</p><p>Chroma’s similarity search feels simple because the hard geometry is packaged for you. Under that calm API:</p><ol><li><strong>Vector indexes</strong> exist so you don’t brute-force the universe.</li><li><strong>HNSW</strong> is a layered “friends-of-friends” graph that trades a little exactness for a lot of speed.</li><li><strong>Construction knobs</strong> carve the map; decides how carefully you travel it.</li><li><strong>Semantic search can still be wrong</strong> — especially when words rhyme across domains.</li><li><strong>Filters aren’t a compromise.</strong> They’re how you turn nearest-neighbor math into product-grade retrieval.</li></ol><p>If you’re building RAG, treat HNSW settings and metadata design as first-class features — not afterthoughts you discover during an outage.</p><p>Your users don’t care that you know what a navigable small world is.<br> They care that “polar bear” never returns a Polars benchmark again.</p><p>Now go break a tiny collection on purpose. It’s the fastest way to learn how your index actually thinks.</p><p><em>Originally published at </em><a href="https://github.com/akhilpenugonda/medium-articles/blob/master/medium/similarity-search-hnsw-chroma/blog.md"><em>https://github.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3a4624f15c0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thecodingway/your-vector-database-isnt-magic-it-s-just-really-good-at-shortcuts-f3a4624f15c0">Your Vector Database Isn’t Magic — It’s Just Really Good at Shortcuts</a> was originally published in <a href="https://medium.com/thecodingway">TheCodingWay</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implement something using multi-threading in Java]]></title>
            <link>https://medium.com/thecodingway/implement-something-using-multi-threading-in-java-385fdc1ab2c7?source=rss----4f9044803049---4</link>
            <guid isPermaLink="false">https://medium.com/p/385fdc1ab2c7</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[multithreading]]></category>
            <category><![CDATA[interview]]></category>
            <dc:creator><![CDATA[Akhil Kumar]]></dc:creator>
            <pubDate>Wed, 12 Jun 2024 01:07:03 GMT</pubDate>
            <atom:updated>2024-06-12T01:06:38.551Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s implement a simple Java program that demonstrates multithreading. We’ll create a scenario where multiple threads print numbers concurrently. This example will illustrate the basic principles of creating, starting, and managing threads in Java.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DFrRG6tzQ2cuStGb" /><figcaption>Photo by <a href="https://unsplash.com/@juliamaior?utm_source=medium&amp;utm_medium=referral">Julia Maior</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Step-by-Step Implementation</h3><ol><li><strong>Create a class that implements </strong><strong>Runnable interface</strong>: This class will define the task that each thread will execute.</li><li><strong>Create and start multiple threads</strong>: We will create instances of the Thread class, passing our Runnable implementation to the constructor.</li></ol><h3>Complete Code Example</h3><pre>// NumberPrinter.java<br>public class NumberPrinter implements Runnable {<br>    private String threadName;<br>    private int start;<br>    private int end;<br>    public NumberPrinter(String threadName, int start, int end) {<br>        this.threadName = threadName;<br>        this.start = start;<br>        this.end = end;<br>    }<br>    @Override<br>    public void run() {<br>        for (int i = start; i &lt;= end; i++) {<br>            System.out.println(threadName + &quot;: &quot; + i);<br>            try {<br>                // Sleep for a bit to simulate work and make the output more readable<br>                Thread.sleep(100);<br>            } catch (InterruptedException e) {<br>                System.out.println(threadName + &quot; interrupted.&quot;);<br>            }<br>        }<br>        System.out.println(threadName + &quot; finished.&quot;);<br>    }<br>    public static void main(String[] args) {<br>        // Create instances of the Runnable task<br>        NumberPrinter printer1 = new NumberPrinter(&quot;Thread-1&quot;, 1, 10);<br>        NumberPrinter printer2 = new NumberPrinter(&quot;Thread-2&quot;, 11, 20);<br>        NumberPrinter printer3 = new NumberPrinter(&quot;Thread-3&quot;, 21, 30);<br>        // Create thread objects and pass the runnable tasks to them<br>        Thread thread1 = new Thread(printer1);<br>        Thread thread2 = new Thread(printer2);<br>        Thread thread3 = new Thread(printer3);<br>        // Start the threads<br>        thread1.start();<br>        thread2.start();<br>        thread3.start();<br>        // Wait for all threads to complete<br>        try {<br>            thread1.join();<br>            thread2.join();<br>            thread3.join();<br>        } catch (InterruptedException e) {<br>            System.out.println(&quot;Main thread interrupted.&quot;);<br>        }<br>        System.out.println(&quot;All threads finished.&quot;);<br>    }<br>}</pre><h3>Explanation</h3><blockquote><strong>NumberPrinter Class</strong>:</blockquote><ul><li>Implements the Runnable interface, allowing instances to be executed by a thread.</li><li>The run method defines the code that constitutes the task of the thread. It prints numbers from start to end, prefixed by the thread&#39;s name.</li><li>The constructor takes parameters for the thread name, start, and end numbers.</li></ul><blockquote><strong>Main Method</strong>:</blockquote><ul><li>Three instances of NumberPrinter are created, each configured to print a different range of numbers.</li><li>Three Thread objects are created, each initialized with one of the NumberPrinter instances.</li><li>The start method is called on each thread to begin execution.</li><li>The join method is used to wait for all threads to complete before the main thread proceeds.</li></ul><h3>Running the Program</h3><p>Compile and run the program using the following commands in your terminal or command prompt:</p><pre>javac NumberPrinter.java<br>java NumberPrinter</pre><p>You should see the output from each thread interleaved, demonstrating concurrent execution. Note that the exact order of output may vary each time you run the program, due to the nature of thread scheduling.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=385fdc1ab2c7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thecodingway/implement-something-using-multi-threading-in-java-385fdc1ab2c7">Implement something using multi-threading in Java</a> was originally published in <a href="https://medium.com/thecodingway">TheCodingWay</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Binary Tree Paths in Python]]></title>
            <link>https://medium.com/thecodingway/exploring-binary-tree-paths-in-python-b80a35deb818?source=rss----4f9044803049---4</link>
            <guid isPermaLink="false">https://medium.com/p/b80a35deb818</guid>
            <category><![CDATA[practice]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[trees]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Akhil Kumar]]></dc:creator>
            <pubDate>Tue, 21 Nov 2023 03:22:11 GMT</pubDate>
            <atom:updated>2023-11-21T03:21:53.729Z</atom:updated>
            <content:encoded><![CDATA[<h4>Dynamic Tree Path Traversal</h4><p>Binary trees are a fundamental data structure in computer science, widely used for representing hierarchical relationships. Traversing a binary tree and finding all possible paths from the root to the leaf nodes is a common problem. In this article, we will explore a Python solution to this problem using a depth-first search (DFS) approach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d40dcEdOHtuOp5am" /><figcaption>Photo by <a href="https://unsplash.com/@silvawebdesigns?utm_source=medium&amp;utm_medium=referral">Nathan da Silva</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Understanding the Code</h3><p>Let’s begin by examining the provided Python code, which is a part of a class named Solution that contains a method called binaryTreePaths. This method takes a root parameter, representing the root of a binary tree, and returns a list of strings representing all possible paths from the root to the leaf nodes.</p><p>The binary tree node is defined by the class TreeNode, which has a constructor initializing the node&#39;s value (val), left child (left), and right child (right).</p><pre>class TreeNode(object):<br>    def __init__(self, val=0, left=None, right=None):<br>        self.val = val<br>        self.left = left<br>        self.right = right</pre><p>Now, let’s break down the binaryTreePaths method.</p><pre>def binaryTreePaths(self, root):<br>    if root is None:<br>        return []<br>    if root.left is None and root.right is None:<br>        return [str(root.val)]<br>    left_subtree_paths = self.binaryTreePaths(root.left)<br>    right_subtree_paths = self.binaryTreePaths(root.right)<br>    left_subtree_paths = [str(root.val) + &quot;-&gt;&quot; + path for path in left_subtree_paths]<br>    right_subtree_paths = [str(root.val) + &quot;-&gt;&quot; + path for path in right_subtree_paths]<br>    return left_subtree_paths + right_subtree_paths</pre><h3>Algorithm Explanation</h3><h4>Base Cases:</h4><ul><li>If the root is None, it means an empty tree, and an empty array is returned.</li><li>If the root is a leaf node (both left and right children are None), a single-element array containing the string representation of the leaf node&#39;s value is returned.</li></ul><h4>Recursive Calls:</h4><ul><li>The method recursively calls itself on the left and right subtrees to obtain the paths from the left and right children.</li></ul><h4>Path Construction:</h4><ul><li>Each path in the left and right subtrees is augmented by appending the current node’s value and an arrow (-&gt;) using list comprehension.</li></ul><h4>Combining Paths:</h4><ul><li>The paths from the left and right subtrees are concatenated, and the final result is returned.</li></ul><h4>Example Usage</h4><p>Let’s illustrate the usage of this code with a simple example:</p><pre># Example tree:<br>#     1<br>#    / \<br>#   2   3<br>#    \<br>#     5<br># Constructing the tree<br>root = TreeNode(1)<br>root.left = TreeNode(2)<br>root.right = TreeNode(3)<br>root.left.right = TreeNode(5)<br># Creating an instance of the Solution class<br>solution = Solution()<br># Finding all binary tree paths<br>paths = solution.binaryTreePaths(root)<br># Displaying the result<br>print(paths)</pre><p>In this example, the expected output would be [&#39;1-&gt;2-&gt;5&#39;, &#39;1-&gt;3&#39;], representing all possible paths from the root to the leaf nodes.</p><h3>Conclusion</h3><p>Understanding and solving problems related to binary trees is crucial for any programmer. The provided Python code efficiently explores all paths in a binary tree, demonstrating the power of recursive algorithms and depth-first search. This solution can be adapted and extended for various applications involving binary tree traversal and path finding.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b80a35deb818" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thecodingway/exploring-binary-tree-paths-in-python-b80a35deb818">Exploring Binary Tree Paths in Python</a> was originally published in <a href="https://medium.com/thecodingway">TheCodingWay</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Difference between Azure Data Factory and Azure Databricks]]></title>
            <link>https://medium.com/thecodingway/difference-between-azure-data-factory-and-azure-databricks-c33eab996d2e?source=rss----4f9044803049---4</link>
            <guid isPermaLink="false">https://medium.com/p/c33eab996d2e</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[microsoft]]></category>
            <dc:creator><![CDATA[Akhil Kumar]]></dc:creator>
            <pubDate>Sat, 18 Nov 2023 02:12:25 GMT</pubDate>
            <atom:updated>2023-11-18T02:10:56.045Z</atom:updated>
            <content:encoded><![CDATA[<p>Azure Data Factory (ADF) and Azure Databricks are both Azure services, but they serve different purposes in the data and analytics landscape:</p><h4>Purpose:</h4><ul><li>Azure Data Factory (ADF): ADF is a cloud-based data integration service that allows you to create, schedule, and manage data pipelines, moving and transforming data from various sources to various destinations.</li><li>Azure Databricks: Databricks is an Apache Spark-based analytics platform optimized for Azure. It provides a collaborative environment for big data and machine learning, allowing you to process and analyze large datasets.</li></ul><h4>Functionality:</h4><ul><li>ADF: Primarily focuses on data integration, ETL (Extract, Transform, Load) processes, and orchestrating workflows for data movement and transformation.</li><li>Databricks: Primarily used for big data processing, analytics, and machine learning. It provides an interactive workspace and collaborative environment for data engineers, data scientists, and analysts.</li></ul><h4>Use Cases:</h4><ul><li>ADF: Suitable for scenarios where you need to move and transform data between different storage and processing systems.</li><li>Databricks: Suited for big data processing, advanced analytics, and machine learning tasks. It’s particularly powerful for scenarios involving large-scale data processing and complex analytics.</li></ul><h4>Technology:</h4><ul><li>ADF: Uses a visual interface for designing data pipelines and supports a wide range of data sources and destinations.</li><li>Databricks: Leverages Apache Spark for distributed data processing. It provides notebooks for interactive data exploration and collaborative development.</li></ul><h4>Integration:</h4><ul><li>ADF: Integrates well with various Azure services, databases, and storage solutions.</li><li>Databricks: Integrates with Azure services and can be used in conjunction with other Azure data services for a comprehensive data solution.</li></ul><p>In summary, ADF is primarily focused on data integration and movement, while Databricks is tailored for big data analytics, machine learning, and collaborative data exploration. Depending on your specific use case, you might use these services independently or together in a complementary manner within your data architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*60KeSsR1DYoYv0x3" /><figcaption>Photo by <a href="https://unsplash.com/@impelling?utm_source=medium&amp;utm_medium=referral">Ed Hardie</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c33eab996d2e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thecodingway/difference-between-azure-data-factory-and-azure-databricks-c33eab996d2e">Difference between Azure Data Factory and Azure Databricks</a> was originally published in <a href="https://medium.com/thecodingway">TheCodingWay</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring the Inorder Traversal Algorithm in JavaScript]]></title>
            <link>https://medium.com/thecodingway/exploring-the-inorder-traversal-algorithm-in-javascript-884aff717af3?source=rss----4f9044803049---4</link>
            <guid isPermaLink="false">https://medium.com/p/884aff717af3</guid>
            <category><![CDATA[akhil-kumar]]></category>
            <category><![CDATA[practice]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Akhil Kumar]]></dc:creator>
            <pubDate>Tue, 31 Oct 2023 02:35:57 GMT</pubDate>
            <atom:updated>2023-10-26T02:01:23.609Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the most fundamental tree traversal methods is the “inorder traversal.” In this article, we’ll delve into the concept of inorder traversal and explore a JavaScript implementation of this algorithm.</p><p>Understanding Inorder Traversal</p><p>Inorder traversal is a binary tree traversal algorithm that visits each node of a tree in a specific order. The order of traversal is as follows:</p><ol><li>Traverse the left subtree.</li><li>Visit the current node.</li><li>Traverse the right subtree.</li></ol><p>The key insight here is that inorder traversal of a binary tree will return the nodes in sorted order when applied to a binary search tree (BST). This is because the left subtree contains smaller values than the current node, and the right subtree contains larger values.</p><blockquote>JavaScript Implementation</blockquote><p>Now, let’s take a look at the JavaScript implementation of the inorder traversal algorithm using a recursive approach:</p><pre>var inorderTraversal = function(root) {<br>    if (!root) {<br>        return [];<br>    }<br>    return inorderTraversal(root.left).concat([root.val]).concat(inorderTraversal(root.right));<br>};</pre><p>Here’s how this code works:</p><ol><li>The inorderTraversal function takes a root node as input, which represents the root of a binary tree.</li><li>If the root is null (i.e., the tree is empty), the function returns an empty array, signifying that there are no nodes to traverse.</li><li>Otherwise, the function recursively applies the inorder traversal algorithm. It first traverses the left subtree by calling inorderTraversal(root.left), then visits the current node by wrapping root.val in an array (to create an array with a single element), and finally traverses the right subtree with inorderTraversal(root.right).</li><li>The three parts are concatenated using the concat method, which combines the left subtree, the current node, and the right subtree into a single array.</li><li>The result is the nodes of the binary tree in sorted order.</li></ol><blockquote>Time Complexity Analysis</blockquote><p>The time complexity of this algorithm can be analyzed by considering the work done for each node in the tree. For each node, the function makes three recursive calls: one for the left subtree, one for the right subtree, and one to create an array with the current node’s value. As a result, the time complexity is O(n), where n is the number of nodes in the binary tree.</p><blockquote>Conclusion</blockquote><p>In this article, we explored the concept of inorder traversal, a fundamental binary tree traversal algorithm. We also provided a JavaScript implementation of the algorithm that returns the nodes of a binary tree in sorted order, particularly when applied to a binary search tree (BST). Understanding and implementing traversal algorithms is crucial for working with tree structures and solving various data manipulation tasks efficiently. The provided code snippet serves as a simple and effective way to perform an inorder traversal of a binary tree in JavaScript.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9u30quiO8HBKpic6" /><figcaption>Photo by <a href="https://unsplash.com/@cgower?utm_source=medium&amp;utm_medium=referral">Christopher Gower</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=884aff717af3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thecodingway/exploring-the-inorder-traversal-algorithm-in-javascript-884aff717af3">Exploring the Inorder Traversal Algorithm in JavaScript</a> was originally published in <a href="https://medium.com/thecodingway">TheCodingWay</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Comprehensive Guide: Installing Flutter on Mac with Terminal Commands]]></title>
            <link>https://medium.com/thecodingway/comprehensive-guide-installing-flutter-on-mac-with-terminal-commands-fd10833f216d?source=rss----4f9044803049---4</link>
            <guid isPermaLink="false">https://medium.com/p/fd10833f216d</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[work]]></category>
            <dc:creator><![CDATA[Akhil Kumar]]></dc:creator>
            <pubDate>Thu, 26 Oct 2023 20:26:15 GMT</pubDate>
            <atom:updated>2023-10-28T00:00:48.997Z</atom:updated>
            <content:encoded><![CDATA[<p>Flutter is a powerful framework for building natively compiled applications for mobile, web, and desktop from a single codebase. In this guide, we’ll walk you through the process of installing Flutter on a Mac using terminal commands.</p><h3>Prerequisites</h3><p>Before you begin, ensure you have the following:</p><ul><li>A Mac with macOS installed.</li><li>A working internet connection.</li></ul><h4>Step 1: Download Flutter</h4><ol><li>Open your terminal.</li><li>In the terminal window, enter the following command to download Flutter’s SDK:</li></ol><pre>git clone https://github.com/flutter/flutter.git -b stable</pre><p>This command will clone the Flutter repository to your local machine.</p><h3>Step 2: Add Flutter to PATH</h3><ol><li>Navigate to your home directory:</li></ol><pre>cd ~</pre><ol><li>Open your bash_profile file (or zshrc if you&#39;re using Zsh) using a text editor. You can use the nano editor:</li></ol><pre>nano .bash_profile</pre><ol><li>Add the Flutter SDK path to the file. This is the directory where you cloned Flutter. Add the following line at the end of the file:</li></ol><pre>export PATH=&quot;$PATH:[PATH_TO_FLUTTER_DIRECTORY]/flutter/bin&quot;</pre><p>Replace [PATH_TO_FLUTTER_DIRECTORY] with the actual path to your Flutter directory.</p><ol><li>Save and exit the text editor (for nano, press CTRL + X, then Y, then Enter).</li><li>Load your updated profile:</li></ol><pre>source .bash_profile</pre><h3>Step 3: Install Xcode Command Line Tools</h3><ol><li>Install Xcode Command Line Tools using the following command:</li></ol><pre>xcode-select --install</pre><ol><li>Follow the prompts to complete the installation.</li></ol><h3>Step 4: Verify Flutter Installation</h3><ol><li>In the terminal, run the following command to verify that Flutter has been correctly installed:</li></ol><pre>flutter --version</pre><p>You should see output indicating the Flutter version and Dart version.</p><h3>Step 5: Complete Flutter Setup</h3><ol><li>Run the following command to complete the Flutter setup:</li></ol><pre>flutter doctor</pre><p>This will check your system for any additional requirements or dependencies needed for Flutter development.</p><p>Congratulations! You’ve successfully installed Flutter on your Mac using terminal commands. You’re now ready to start building amazing cross-platform applications.</p><h3>Conclusion</h3><p>In this guide, we covered the step-by-step process of installing Flutter on a Mac using terminal commands. With Flutter installed, you’re well-equipped to embark on your journey in mobile app development.</p><h3>See Also</h3><ul><li>📖 <a href="https://flutter.dev/docs/get-started/install">Official Flutter Installation Guide</a></li><li>🚀 <a href="https://github.com/flutter/flutter">Flutter GitHub Repository</a></li></ul><h3>You May Also Enjoy</h3><ul><li>📝 <a href="https://www.google.com/search?q=getting+started+with+dart+programming">Getting Started with Dart Programming Language</a> for a deeper understanding of the language that powers Flutter.</li></ul><p>Happy coding!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RdejKAbC7GhoP5Sb" /><figcaption>Photo by <a href="https://unsplash.com/@brett_jordan?utm_source=medium&amp;utm_medium=referral">Brett Jordan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd10833f216d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thecodingway/comprehensive-guide-installing-flutter-on-mac-with-terminal-commands-fd10833f216d">Comprehensive Guide: Installing Flutter on Mac with Terminal Commands</a> was originally published in <a href="https://medium.com/thecodingway">TheCodingWay</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unraveling the Missing Number Algorithm in JavaScript]]></title>
            <link>https://medium.com/thecodingway/unraveling-the-missing-number-algorithm-in-javascript-a5550ba033ab?source=rss----4f9044803049---4</link>
            <guid isPermaLink="false">https://medium.com/p/a5550ba033ab</guid>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[daily-blog]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[Akhil Kumar]]></dc:creator>
            <pubDate>Fri, 20 Oct 2023 02:54:01 GMT</pubDate>
            <atom:updated>2023-10-20T02:54:01.597Z</atom:updated>
            <content:encoded><![CDATA[<p>In the realm of programming, efficiency and accuracy are paramount. One common problem that developers encounter is finding a missing number in an array. This task can be approached in various ways, but one elegant solution stands out: the algorithm using mathematical properties. In this article, we’ll delve into a JavaScript function that employs this approach to find a missing number within an array.</p><blockquote>Understanding the Algorithm</blockquote><p>The provided JavaScript function aims to identify a missing number within an array. Let’s dissect it step by step.</p><pre>/**<br> * @param {number[]} nums<br> * @return {number}<br> */<br>var missingNumber = function(nums) {<br>    let n = nums.length;<br>    let expectedSum = (n*(n+1))/2;<br>    let actualSum = nums.reduce((sum, num) =&gt; sum + num, 0);<br>    <br>    return expectedSum - actualSum;<br>};</pre><ol><li>Function Signature: The function missingNumber takes an array of numbers nums as input and returns a single number.</li><li>Getting the Length of the Array:</li></ol><ul><li>javascriptCopy code</li><li>let n = nums.length;</li></ul><ol><li>Here, n represents the length of the array nums.</li><li>Calculating the Expected Sum:</li></ol><ul><li>javascriptCopy code</li><li>let expectedSum = (n*(n+1))/2;</li></ul><ol><li>The expected sum of a sequence of n natural numbers can be calculated using the formula (n * (n + 1)) / 2. This formula is derived from the arithmetic sum formula. It&#39;s worth noting that the array contains a sequence of natural numbers, and only one number is missing.</li><li>Calculating the Actual Sum</li></ol><ul><li>javascriptCopy code</li><li>let actualSum = nums.reduce((sum, num) =&gt; sum + num, 0);</li></ul><ol><li>The reduce function is used to sum up all the elements in the array nums. The initial value of sum is set to 0, and for each element num, it adds it to the current sum.</li><li>Finding the Missing Number:</li></ol><ul><li>javascriptCopy code</li><li>return expectedSum - actualSum;</li></ul><blockquote>Subtracting the actual sum from the expected sum reveals the missing number.</blockquote><blockquote>How It Works</blockquote><p>The brilliance of this algorithm lies in its simplicity. By leveraging the mathematical property of the sum of natural numbers, we can efficiently find the missing element. This approach has a time complexity of O(n), where n is the length of the array. It traverses the array once to calculate the actual sum.</p><h4>Conclusion</h4><p>The algorithm presented here exemplifies the power of combining mathematical principles with programming. By exploiting the properties of natural numbers, we’ve created an elegant and efficient solution to the problem of finding a missing number in an array. Understanding and utilizing such techniques not only enhances our problem-solving skills but also allows us to write more efficient and concise code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*owNkbLFDyYwxAJMQracp4Q.jpeg" /></figure><p>In practice, this algorithm can be invaluable, especially when dealing with large datasets where efficiency is crucial. By incorporating these principles into our coding arsenal, we can tackle a wide array of problems with grace and efficiency. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5550ba033ab" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thecodingway/unraveling-the-missing-number-algorithm-in-javascript-a5550ba033ab">Unraveling the Missing Number Algorithm in JavaScript</a> was originally published in <a href="https://medium.com/thecodingway">TheCodingWay</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unraveling the Happiness: Understanding the Happy Number Algorithm]]></title>
            <link>https://medium.com/thecodingway/unraveling-the-happiness-understanding-the-happy-number-algorithm-34ec8abc7e2d?source=rss----4f9044803049---4</link>
            <guid isPermaLink="false">https://medium.com/p/34ec8abc7e2d</guid>
            <category><![CDATA[practice]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Akhil Kumar]]></dc:creator>
            <pubDate>Thu, 19 Oct 2023 17:02:37 GMT</pubDate>
            <atom:updated>2023-10-19T17:02:37.209Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Code can be poetry, an art form that solves problems.</em> In this piece, we’ll explore a JavaScript algorithm that determines if a number is happy or not. This algorithm leverages the concept of “happy numbers” from number theory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MbqlVEZGva-r7mKvtE6Rzg.jpeg" /></figure><blockquote>Introduction</blockquote><p>In the realm of mathematics, “happy numbers” are a fascinating concept. A happy number is defined by the following process:</p><ol><li>Start with any positive integer.</li><li>Replace the number by the sum of the squares of its digits.</li><li>Repeat the process until the number equals 1, or it loops endlessly in a cycle that does not include 1.</li></ol><p>In this article, we’ll dissect a JavaScript code snippet that detects happy numbers using this process.</p><h4>The Code</h4><pre>/**<br> * @param {number} n<br> * @return {boolean}<br> */<br>var isHappy = function(n) {<br>    let visited = new Set();<br>    while(!visited.has(n))<br>    {<br>        visited.add(n);<br>        n = sumOfSquares(n);<br>        if(n == 1){<br>            return true;<br>        }<br>    }<br>    return false;<br>};<br>var sumOfSquares = function(n){<br>    let sum = 0;<br>    while(n &gt; 0)<br>    {<br>        sum += (n%10)*(n%10);<br>        n = Math.floor(n/10);<br>    }<br>    return sum;<br>}</pre><h4>Exploring the Code</h4><h4>The isHappy Function</h4><p>This function takes an integer n as input and returns a boolean value. It employs a while loop to iterate through the process of finding a happy number.</p><ol><li>let visited = new Set();: A set called visited is initialized. This set will be used to keep track of visited numbers to prevent infinite loops.</li><li>while(!visited.has(n)): This loop continues as long as n is not present in the visited set. It ensures we don&#39;t revisit a number, which could lead to an infinite loop.</li><li>visited.add(n);: Within the loop, the current value of n is added to the visited set to mark it as visited.</li><li>n = sumOfSquares(n);: The value of n is updated using the sumOfSquares function. This applies the process of replacing the number with the sum of the squares of its digits.</li><li>if(n == 1){ return true; }: If n becomes 1 after the process, it is identified as a happy number, and the function returns true.</li><li>Finally, if the loop completes without finding a happy number, the function returns false.</li></ol><h3>The sumOfSquares Function</h3><p>This function takes a positive integer n and computes the sum of the squares of its digits.</p><ol><li>let sum = 0;: Initializes a variable sum to keep track of the sum of squares.</li><li>while(n &gt; 0): This loop continues as long as n is greater than 0.</li><li>(n%10)*(n%10): Retrieves the last digit of n using the modulo operator %, squares it, and adds it to sum.</li><li>n = Math.floor(n/10);: Removes the last digit of n by performing integer division.</li><li>Finally, the function returns the computed sum.</li></ol><h3>Conclusion</h3><p>The provided JavaScript code elegantly implements the algorithm to determine whether a number is happy or not. It leverages a set to keep track of visited numbers and two functions to handle the processes involved.</p><p>Understanding and appreciating such algorithms not only enriches our programming skills but also allows us to appreciate the beauty in problem-solving through code. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34ec8abc7e2d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thecodingway/unraveling-the-happiness-understanding-the-happy-number-algorithm-34ec8abc7e2d">Unraveling the Happiness: Understanding the Happy Number Algorithm</a> was originally published in <a href="https://medium.com/thecodingway">TheCodingWay</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Palindrome Numbers with JavaScript: A Step-by-Step Guide]]></title>
            <link>https://medium.com/thecodingway/exploring-palindrome-numbers-with-javascript-a-step-by-step-guide-5c50c0eb8eea?source=rss----4f9044803049---4</link>
            <guid isPermaLink="false">https://medium.com/p/5c50c0eb8eea</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Akhil Kumar]]></dc:creator>
            <pubDate>Thu, 19 Oct 2023 03:49:38 GMT</pubDate>
            <atom:updated>2023-10-19T03:49:38.263Z</atom:updated>
            <content:encoded><![CDATA[<p>Leetcode: <a href="https://leetcode.com/problems/palindrome-number/">9. Palindrome Number</a></p><p>Palindrome numbers are fascinating mathematical constructs that read the same backward as forward (e.g., 121, 1331, 1221). In this article, we’ll dive into a JavaScript code snippet that determines whether a given number is a palindrome or not. We’ll break down the code step by step, providing explanations for each segment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f2MrZfM3g-5drd8cUvd9Zg.jpeg" /></figure><pre>/**<br> * @param {number} x<br> * @return {boolean}<br> */<br>var isPalindrome = function(x) {<br>    let ref = 0;<br>    let temp = x;<br>    while(x &gt; 0)<br>    {<br>        ref = ref*10 + x%10;<br>        x = Math.floor(x/10);<br>    }<br>    if(ref == temp)<br>    {<br>        return true;<br>    }<br>    return false<br>};</pre><p>Explanation</p><blockquote>Function Definition</blockquote><ul><li>var isPalindrome = function(x): This line defines a JavaScript function named isPalindrome that takes a single parameter x, which is expected to be a number.</li></ul><blockquote>Variable Initialization</blockquote><ul><li>let ref = 0; and let temp = x;: Two variables ref and temp are initialized. ref is set to 0, and temp is assigned the value of x. These variables are used to store intermediate and original values of x respectively.</li></ul><blockquote>While Loop</blockquote><ul><li>while(x &gt; 0) {...}: This initiates a while loop. The loop condition checks if x is greater than 0.</li></ul><blockquote>Loop Body</blockquote><ul><li>Inside the while loop, two operations are performed:</li><li>ref = ref * 10 + x % 10;: This line appends the last digit of x to ref by multiplying ref by 10 and adding the remainder of x divided by 10.</li><li>x = Math.floor(x / 10);: This updates x by removing its last digit (using integer division).</li></ul><blockquote>Checking for Palindrome</blockquote><ul><li>if(ref == temp) {...}: After the loop terminates, the code checks if ref (which now contains the reverse of x) is equal to temp (the original value of x).</li></ul><blockquote>Return Statement</blockquote><ul><li>return true; and return false;: Depending on the result of the comparison, the function returns true if x is a palindrome and false otherwise.</li></ul><h4>Conclusion</h4><p>In this article, we’ve examined a JavaScript function that checks if a given number is a palindrome. We dissected each component of the code to provide a clear understanding of how it operates. By employing techniques like loops and basic arithmetic operations, this function efficiently determines whether a number exhibits the intriguing property of palindromicity. This code serves as a valuable resource for both learning JavaScript and exploring the fascinating world of palindromic numbers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c50c0eb8eea" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thecodingway/exploring-palindrome-numbers-with-javascript-a-step-by-step-guide-5c50c0eb8eea">Exploring Palindrome Numbers with JavaScript: A Step-by-Step Guide</a> was originally published in <a href="https://medium.com/thecodingway">TheCodingWay</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Converting Excel Column Numbers to Alphabetic Titles: A JavaScript Approach in simple 9 Steps]]></title>
            <link>https://medium.com/thecodingway/converting-excel-column-numbers-to-alphabetic-titles-a-javascript-approach-in-simple-9-steps-6bfe91f7364b?source=rss----4f9044803049---4</link>
            <guid isPermaLink="false">https://medium.com/p/6bfe91f7364b</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Akhil Kumar]]></dc:creator>
            <pubDate>Thu, 19 Oct 2023 02:29:10 GMT</pubDate>
            <atom:updated>2023-10-19T02:29:01.329Z</atom:updated>
            <content:encoded><![CDATA[<p>Leet Code: <a href="https://leetcode.com/problems/excel-sheet-column-title/">168. Excel Sheet Column Title</a></p><p>If you’ve ever worked with Excel, you might be familiar with column numbers (e.g., A, B, C, …, Z, AA, AB, AC, …, ZZ, AAA, AAB, etc.). These alphanumeric titles are commonly used to refer to specific columns in a spreadsheet. However, have you ever wondered how you can programmatically convert a column number to its corresponding title? In this article, we’ll explore a JavaScript function that does just that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O-e4DstxoNKAxN6YkqerXQ.jpeg" /><figcaption>Image from Pixels “Man Coding”</figcaption></figure><h3>The Code</h3><p>Let’s start by taking a closer look at the code:</p><pre>var convertToTitle = function(columnNumber) {<br>    const numberToCharacterMap = {};<br>    for (let i = 1; i &lt;= 26; i++) {<br>        const character = String.fromCharCode(i + 64);<br>        numberToCharacterMap[i] = character;<br>    }<br>    let resp = &quot;&quot;;<br>    while(columnNumber &gt; 0) {<br>        let remainder = columnNumber % 26;<br>        if (remainder === 0) {<br>            resp = &#39;Z&#39; + resp;<br>            columnNumber = Math.floor(columnNumber / 26) - 1;<br>        } else {<br>            resp = numberToCharacterMap[remainder] + resp;<br>            columnNumber = Math.floor(columnNumber / 26);<br>        }<br>    }<br>    return resp;<br>};</pre><h3>Understanding the Code</h3><p>Let’s break down this code step by step:</p><blockquote>1. const numberToCharacterMap = {};</blockquote><p>This line initializes an empty object called numberToCharacterMap. This object will be used to map numbers to their corresponding alphabetic characters (1 maps to &#39;A&#39;, 2 maps to &#39;B&#39;, and so on).</p><blockquote>2. for (let i = 1; i &lt;= 26; i++) { ... }</blockquote><p>This loop populates the numberToCharacterMap object. It iterates from 1 to 26 (inclusive), which corresponds to the 26 letters of the alphabet.</p><blockquote>3. const character = String.fromCharCode(i + 64);</blockquote><p>This line converts the current value of i into its corresponding character using the String.fromCharCode() method. Since &#39;A&#39; has a character code of 65, we add 64 to i to get the correct character code.</p><blockquote>4. numberToCharacterMap[i] = character;</blockquote><p>This line assigns the character (e.g., ‘A’, ‘B’, ‘C’, …) to the corresponding number in the numberToCharacterMap object.</p><blockquote>5. let resp = &quot;&quot;;</blockquote><p>This initializes an empty string called resp, which will be used to store the resulting title.</p><blockquote>6. while(columnNumber &gt; 0) { ... }</blockquote><p>This initiates a while loop. As long as columnNumber is greater than 0, the loop will continue.</p><blockquote>7. let remainder = columnNumber % 26;</blockquote><p>Inside the loop, this line calculates the remainder when columnNumber is divided by 26. This is used to determine the current character.</p><blockquote>8. if (remainder === 0) { ... } else { ... }</blockquote><p>Depending on whether the remainder is zero or not, the code executes one of two branches.</p><ul><li>If the remainder is zero, it means the column number is a multiple of 26. In this case, we append ‘Z’ to the resp string and adjust columnNumber accordingly.</li><li>If the remainder is non-zero, we use the numberToCharacterMap to find the corresponding character and append it to resp.</li></ul><blockquote>9. return resp;</blockquote><p>Finally, the resulting title is returned.</p><h4>Conclusion</h4><p>This JavaScript function, convertToTitle, provides an elegant solution to convert Excel column numbers into their corresponding alphabetic titles. By leveraging a mapping object and some arithmetic operations, it efficiently handles various cases. This function can be a valuable tool for tasks involving spreadsheet manipulation in your JavaScript applications. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6bfe91f7364b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thecodingway/converting-excel-column-numbers-to-alphabetic-titles-a-javascript-approach-in-simple-9-steps-6bfe91f7364b">Converting Excel Column Numbers to Alphabetic Titles: A JavaScript Approach in simple 9 Steps</a> was originally published in <a href="https://medium.com/thecodingway">TheCodingWay</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>