<?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"><channel><title><![CDATA[My Tech Journey]]></title><description><![CDATA[My Tech Journey]]></description><link>https://mibhurdev.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 07 Nov 2026 09:44:34 GMT</lastBuildDate><atom:link href="https://mibhurdev.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Day 1 of My DSA Journey: From Flowcharts to My First Java Code (And an Elegant Math Trick!)]]></title><description><![CDATA[Follow my Java DSA Journey as I learn flowcharts, write my first Java program, and discover an elegant math trick for beginners.]]></description><link>https://mibhurdev.hashnode.dev/day-1-of-my-dsa-journey-from-flowcharts-to-my-first-java-code-and-an-elegant-math-trick</link><guid isPermaLink="true">https://mibhurdev.hashnode.dev/day-1-of-my-dsa-journey-from-flowcharts-to-my-first-java-code-and-an-elegant-math-trick</guid><category><![CDATA[data structures]]></category><category><![CDATA[Java]]></category><category><![CDATA[DSA]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Mibhur Mahajan]]></dc:creator><pubDate>Mon, 13 Jul 2026 20:46:04 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6a553e4256dc976b18aff0ea/169a498e-22fe-4a74-bed5-cefa61c057b5.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2><strong>Day 1 of My DSA Journey: From Flowcharts to My First Java Code (And an Elegant Math Trick!)</strong></h2>
<p>The journey of a thousand miles begins with a single step — or in the case of a Computer Science student, a single line of code.</p>
<p>I’ve officially kicked off my Data Structures and Algorithms (DSA) public learning journey by diving into Kunal Kushwaha’s famous Java playlist. Going into Lecture 1, I thought I’d be immediately overwhelmed by complex Java syntax. Instead, I spent the first half of my day drawing shapes and the second half uncovering why Java is such a powerhouse language.</p>
<p>Here is everything I learned on Day 1, including a brilliant prime-number optimization trick that absolutely blew my mind.</p>
<h2><strong>Part 1: Thinking in Pictures (Flowcharts &amp; Pseudocode)</strong></h2>
<p>Before you write code for a computer, you have to clear up the logic in your own head. That’s where <strong>Flowcharts</strong> (visual maps) and <strong>Pseudocode</strong> (writing logic in plain English) come in.</p>
<p>I started by learning the core toolkit of flowchart building blocks:</p>
<ul>
<li><p>🛑 <strong>Oval:</strong> Start / Stop</p>
</li>
<li><p>📥 <strong>Parallelogram:</strong> Input / Output (getting data or displaying it)</p>
</li>
<li><p>⚙️ <strong>Rectangle:</strong> Processing (doing calculations like math operations)</p>
</li>
<li><p>💎 <strong>Diamond:</strong> Conditions (asking True/False questions to split the logic path)</p>
</li>
</ul>
<h2><strong>Warming Up with Simple Logic</strong></h2>
<p>To get comfortable, I mapped out a few fundamental problems:</p>
<ol>
<li><p><strong>The Hello Name Flowchart:</strong> A simple flow that takes a name as an input and outputs <code>"Hello {Name}"</code>.</p>
</li>
<li><p><strong>The Salary Bonus Problem:</strong> A slightly more advanced flow with a condition. If a user inputs a salary greater than 10,000, they get a 2,000 bonus. Otherwise, they only get a 1,000 bonus.</p>
</li>
</ol>
<p>Visualizing the path of execution using these arrows makes it incredibly obvious how data moves through a program.</p>
<h2><strong>🛑 The “Aha!” Moment: Optimizing the Prime Number Problem</strong></h2>
<p>Things got real when I tried to design a flowchart and pseudocode to check if a number is <strong>Prime</strong> or not.</p>
<p>The standard approach is straightforward: you start a counter at \(c = 2\) and check if the number can be divided perfectly (<code>num % c == 0</code>). If it can, it's not prime. If it can't, you increment $c$ by 1 (<code>c = c + 1</code>) and loop back, checking every single number all the way up to <code>num - 1</code>.</p>
<h2><strong>The Problem? It’s slow. Very slow for large numbers.</strong></h2>
<p>But then came the optimization insight that made everything click. Let’s look at the factors of the number 36:</p>
<ul>
<li><p>1 * 36 = 36</p>
</li>
<li><p>2 * 18 = 36</p>
</li>
<li><p>3 * 12 = 36</p>
</li>
<li><p>4 * 9 = 36</p>
</li>
<li><p>6 * 6 = 36</p>
</li>
<li><p>— — — — — — — — — <em>(The Mirror Line)</em></p>
</li>
<li><p><em>9 * 4 = 36 (Ignore! We already checked 4 x 9)</em></p>
</li>
<li><p>12 * 3 = 36 <em>(Ignore!)</em></p>
</li>
<li><p><em>18 * 2 = 36 (Ignore!)</em></p>
</li>
</ul>
<p>Notice how past 6 times 6(the square root of 36), the factors just repeat themselves in reverse order? This means <strong>we don’t have to check all the way to the end!</strong></p>
<p>By changing our loop condition from <code>while c &lt; num</code> to <code>while c * c &lt;= num</code> (checking only up to the square root of the number), we drastically reduce the work the computer has to do. For a number like 17, instead of checking up to 16, we only check 2, 3, and 4. That is pure efficiency!</p>
<h2><strong>Part 2: What Happens Under the Hood of Java?</strong></h2>
<p>After conquering the logic, it was time to understand how Java actually talks to our computers. I mapped out the entire execution pipeline in my notes:</p>
<p>SOURCE CODE — —COMPILER — → BYTE CODE(.CLASS FILE) — — INTERPRETER— → MACHINE CODE (0 &amp; 1)</p>
<h2><strong>The Secret to Java’s Superpower: Platform Independence</strong></h2>
<p>If you write code in C or C++, the compiler converts it into an <code>.exe</code> file tailored specifically to your computer's architecture. That makes C/C++ <strong>platform-dependent</strong>.</p>
<p>Java does things differently. The Java compiler converts your code into <strong>Bytecode</strong> (a <code>.class</code> file). This bytecode doesn't care what operating system you are using. Any computer with a <strong>Java Virtual Machine (JVM)</strong> can read it.</p>
<blockquote>
<p><em>💡</em> <em><strong>Key Takeaway:</strong></em> <em>Java as a language is</em> <em><strong>platform-independent</strong></em> <em>because its bytecode can run anywhere, but the JVM itself is</em> <em><strong>platform-dependent</strong></em> <em>because it must be custom-built for Windows, Mac, or Linux to translate that bytecode into native machine code.</em></p>
</blockquote>
<h2><strong>Part 3: Writing My First Java Program!</strong></h2>
<p>To wrap up Day 1, I finally opened the IDE and wrote the classic starter code:</p>
<p>Java</p>
<pre><code class="language-plaintext">public class Main {
    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}
</code></pre>
<h2><strong>A Quick Trick I Learned About Strings</strong></h2>
<p>While learning about data inputs, I noted two crucial details that often trip up beginners:</p>
<ul>
<li><p><strong>Strings are not primitive data types.</strong> Unlike integers or characters, a String can be broken down into smaller individual data types (a sequence of <code>char</code> types).</p>
</li>
<li><p><a href="http://input.next"><code>input.next</code></a><code>()</code> <strong>vs</strong> <code>input.nextLine()</code><strong>:</strong> If you use <code>next()</code>, Java will only read the <em>first word</em> you type before a space. If you want to grab the <em>entire sentence</em>, you have to use <code>nextLine()</code>.</p>
</li>
</ul>
<h2><strong>Wrapping Up Day 1</strong></h2>
<p>Day 1 taught me that coding is 80% problem-solving logic and only 20% syntax. Taking the time to optimize a prime number loop on paper before writing a single line of Java showed me exactly why studying DSA is so important.</p>
<p><strong>What’s coming next:</strong> Tomorrow, I will be moving past the setup phase and diving deeper into Java variables, primitive data types, and taking clean user inputs.</p>
<p><em>Are you studying DSA right now or thinking about starting? Let’s keep each other accountable! Leave a comment below with your favorite coding shortcut or what language you’re learning.</em></p>
<p>CONTACT :</p>
<p>Email : <a href="mailto:mhjnmibhur23@gmail.com">mhjnmibhur23@gmail.com</a></p>
<p>LinkedIn : <a href="https://www.linkedin.com/in/mibhurmahajan">https://www.linkedin.com/in/mibhurmahajan</a></p>
<p>Twitter : <a href="https://x.com/mhjnmibhur05">https://x.com/mhjnmibhur05</a></p>
]]></content:encoded></item></channel></rss>