<?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>Forem: DamianZoirbile</title>
    <description>The latest articles on Forem by DamianZoirbile (@showwaiyan).</description>
    <link>https://forem.com/showwaiyan</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%2F644518%2Fd1fe924c-8d0a-44fb-a9fa-0de5f9e6319a.jpg</url>
      <title>Forem: DamianZoirbile</title>
      <link>https://forem.com/showwaiyan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/showwaiyan"/>
    <language>en</language>
    <item>
      <title>The Wizard's Code: Finding the Nth Fibonacci Number in Three Ways</title>
      <dc:creator>DamianZoirbile</dc:creator>
      <pubDate>Sat, 15 Feb 2025 07:15:22 +0000</pubDate>
      <link>https://forem.com/showwaiyan/the-wizards-code-finding-the-nth-fibonacci-number-in-three-ways-5bi5</link>
      <guid>https://forem.com/showwaiyan/the-wizards-code-finding-the-nth-fibonacci-number-in-three-ways-5bi5</guid>
      <description>&lt;p&gt;In the ancient kingdom of &lt;strong&gt;&lt;em&gt;Numaria&lt;/em&gt;&lt;/strong&gt;, where magic and mathematics intertwined, a mysterious book appeared through a glowing portal. &lt;strong&gt;&lt;em&gt;Sam&lt;/em&gt;&lt;/strong&gt;, a young scholar with an insatiable curiosity, discovered this futuristic book and learned about a fascinating sequence—the Fibonacci sequence. But how could he find the nth Fibonacci number efficiently? He sought the wisdom of &lt;strong&gt;&lt;em&gt;Eldrin&lt;/em&gt;&lt;/strong&gt;, the legendary scholar wizard who knew the secrets of the past, present, and future.&lt;/p&gt;

&lt;h2&gt;
  
  
  The First Method: Recursion (A Bewitching but Costly Spell)
&lt;/h2&gt;

&lt;p&gt;Eldrin waved his staff, and a magical projection appeared, showing the first method—recursion. "This method follows the natural definition of the Fibonacci sequence," he explained.&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;function&lt;/span&gt; &lt;span class="nf"&gt;fibonacciRecursive&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;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;fibonacciRecursive&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="o"&gt;+&lt;/span&gt; &lt;span class="nf"&gt;fibonacciRecursive&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;2&lt;/span&gt;&lt;span class="p"&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="nf"&gt;fibonacciRecursive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// Output: 8&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sam watched as numbers split and branched endlessly like an enchanted tree. "This spell is too chaotic! Each number calls upon two more, and the calculations grow exponentially!" he protested. Eldrin nodded. "Indeed, this method has O(2^n) time complexity, making it inefficient for large numbers. We need a better way."&lt;/p&gt;

&lt;h2&gt;
  
  
  The Second Method: Iterative Approach (The March of Soldiers)
&lt;/h2&gt;

&lt;p&gt;Eldrin then conjured another method—iteration using loops. "Instead of invoking magic recursively, we march forward step by step," he said, drawing a straight path.&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;function&lt;/span&gt; &lt;span class="nf"&gt;fibonacciIterative&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;a&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="nx"&gt;b&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="k"&gt;for &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;i&lt;/span&gt; &lt;span class="o"&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;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&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;temp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;temp&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&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="nf"&gt;fibonacciIterative&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// Output: 8&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sam observed, "This is better, but as numbers grow, the march becomes longer and takes more time!" Eldrin sighed. "Yes, this runs in O(n) time complexity, which is an improvement, but not the ultimate solution."&lt;/p&gt;

&lt;h2&gt;
  
  
  The Third Method: The Secret Formula (The Wizard’s Final Revelation)
&lt;/h2&gt;

&lt;p&gt;Eldrin flipped to a hidden page in the book, revealing an ancient formula—Binet’s Formula.&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;function&lt;/span&gt; &lt;span class="nf"&gt;fibonacciFormula&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sqrt5&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sqrt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&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;phi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;sqrt5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;phi&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="o"&gt;-&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;phi&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;sqrt5&lt;/span&gt;&lt;span class="p"&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="nf"&gt;fibonacciFormula&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// Output: 8&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sam gasped as glowing golden symbols formed in the air. "A single formula that instantly finds any Fibonacci number?" Eldrin smiled. "Yes, this has O(1) time complexity, making it the most efficient method. It’s the true power of mathematics in programming!"&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion: The Magic of Optimization
&lt;/h2&gt;

&lt;p&gt;Sam learned a great lesson that day—&lt;strong&gt;every problem has an optimized solution&lt;/strong&gt;, and &lt;strong&gt;mathematics holds the key&lt;/strong&gt;. "Never settle for brute force," Eldrin advised. "&lt;strong&gt;Recognize patterns, think mathematically, and seek the best approach&lt;/strong&gt;."&lt;/p&gt;

&lt;p&gt;With newfound wisdom, Sam set out to apply this principle to every challenge he faced. And so, the legend of the Fibonacci Wizard spread across Numaria, inspiring generations of scholars and programmers alike.&lt;/p&gt;

&lt;p&gt;This story highlights the importance of mathematical thinking in programming. Optimization matters! Which method do you prefer when solving problems?&lt;/p&gt;

</description>
      <category>programming</category>
      <category>mathematic</category>
      <category>problemsolving</category>
    </item>
    <item>
      <title>How to start the programming journey in a proper and the best way</title>
      <dc:creator>DamianZoirbile</dc:creator>
      <pubDate>Wed, 31 Jan 2024 06:14:55 +0000</pubDate>
      <link>https://forem.com/showwaiyan/how-to-start-the-programming-journey-in-a-proper-and-the-best-way-2542</link>
      <guid>https://forem.com/showwaiyan/how-to-start-the-programming-journey-in-a-proper-and-the-best-way-2542</guid>
      <description>&lt;h2&gt;
  
  
  You get the right here!!!
&lt;/h2&gt;

&lt;p&gt;Do you ever find yourself wasting time researching the right path for your career, unsure of where to focus? Perhaps you've been watching numerous YouTube videos to identify a programming language that suits your career, and you're uncertain about which field to choose. If so, you're in the right place. I will guide you through &lt;em&gt;a well-founded path&lt;/em&gt; for your future career in software development or other tech-related fields.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Dungeons You would enter
&lt;/h2&gt;

&lt;p&gt;Programming serves as the engine propelling various paths, acting as the vehicles navigating those paths. As stated in the above quote, programming is &lt;strong&gt;a fundamental tool within the development field&lt;/strong&gt;. To excel, you must also acquire proficiency in other technologies relevant to your chosen path. While there is a multitude of fields to explore throughout your life, it's crucial to consistently remind yourself not to hastily jump from one to another. Mastering a skill requires time and dedication. Now, let's delve into some trending and in-demand fields, categorized for your convenience.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq5bi57v5cel85whv2cxi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq5bi57v5cel85whv2cxi.png" alt="filed-chart" width="800" height="726"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: I won't delve into the detailed explanations of these fields here; however, you can explore these topics on YouTube, where a plethora of content is readily available. Each of these sectors requires a certain level of programming expertise. The specific skill level may vary among them, but proficiency in programming is a prerequisite for success in all these sectors.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;At this moment, you may already have a clear path to follow, or you might find yourself uncertain. Alternatively, you may have a chosen path but lack clarity on where to commence. Don't worry—I guarantee that the steps I will present serve as a solid foundation applicable across various sectors.&lt;/p&gt;




&lt;h2&gt;
  
  
  Every first step is always difficult!!
&lt;/h2&gt;

&lt;p&gt;You need to prepare mentally for a career in this field, as it is constantly challenging and requires staying updated on the latest technologies. It can be overwhelming and frustrating at times, but remember, if things are difficult, you are on the right path. Facing challenges builds strength. Remind yourself that you will encounter ups and downs.&lt;/p&gt;

&lt;p&gt;Believe in the power of a &lt;strong&gt;slow burn&lt;/strong&gt;, consistency, and discipline. While motivation is important, rely on consistency and discipline to see you through. &lt;em&gt;Don't bite off more than you can chew in the initial steps&lt;/em&gt;. Also, trust the process. Becoming a developer is not achieved simply by learning a programming language; &lt;strong&gt;it's a lifelong journey&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So, let's get started.&lt;/p&gt;




&lt;h2&gt;
  
  
  Your First Programming Language
&lt;/h2&gt;

&lt;p&gt;From my experience, the most suitable programming language for beginners is &lt;strong&gt;Python&lt;/strong&gt;, and here's why.&lt;/p&gt;

&lt;p&gt;I won't delve into a detailed explanation of what Python is, but in short, it is a programming language widely used across various fields, including the medical domain. While this blog won't provide an exhaustive overview of Python's intricacies, I'll explain why it's an excellent choice for beginners.&lt;/p&gt;

&lt;p&gt;Firstly, Python is &lt;strong&gt;easy to write and understand&lt;/strong&gt;, resembling human language. This feature is crucial for beginners who might initially feel that programming involves creating something only a computer can comprehend. Python's readability is exceptionally convenient for newcomers.&lt;/p&gt;

&lt;p&gt;Secondly, there is &lt;strong&gt;an abundance of resources available for self-learning&lt;/strong&gt;. My very first programming course was on YouTube, and it was entirely free. You'll find high-quality content for Python readily accessible.&lt;/p&gt;

&lt;p&gt;Last but not least, as previously mentioned, Python is utilized in various fields. This versatility &lt;strong&gt;allows you to apply your Python knowledge across sectors&lt;/strong&gt;, making it a winning choice. Python is particularly in demand in Artificial Intelligence and widely used in web development as a backend programming language and in game development. While Python has its drawbacks, the key point I want to emphasize is that learning Python as your programming language won't leave you at a disadvantage.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Study Plan
&lt;/h2&gt;

&lt;p&gt;From my experience, my study plan is composed of three key elements.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9kxad99om1pq8l58cxq0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9kxad99om1pq8l58cxq0.png" alt="study-elements" width="602" height="575"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Learning
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Learning&lt;/strong&gt; is an essential part of your journey, and you should always remind yourself that learning is a lifelong commitment in this career. Now, let's discuss "Where to learn," while the topic of "How to learn" will be covered in the next section on Practicing.&lt;/p&gt;

&lt;h4&gt;
  
  
  YouTube Videos
&lt;/h4&gt;

&lt;p&gt;YouTube Videos are &lt;em&gt;an excellent resource, especially for those seeking free and quality content rather than paid courses&lt;/em&gt;. Learning with free resources is not a disadvantage, and I recommend starting with YouTube, just as I did. It's a cost-effective option, and if you find it doesn't suit your preferences, don't worry—it's free, and you can explore other options.&lt;/p&gt;

&lt;p&gt;In this context, I can assure you that playlists of videos divided by topics are much more effective than longer videos that are approximately 2 hours or more.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Noted: It's important to understand that the length of a video doesn't necessarily correlate with the amount of information it contains. Therefore, when choosing resources, focus on finding playlists of videos that offer comprehensive content. Learn systematically, going through each topic in detail. If you encounter difficulty understanding a concept, don't hesitate to rewatch the video or seek out alternative explanations from different videos. In conclusion, leverage YouTube playlists to build a solid understanding of the basic foundational knowledge.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Course
&lt;/h4&gt;

&lt;p&gt;You can opt to buy or enroll in a specific course that aligns with your interests. I don't need to elaborate on this because taking a course is straightforward—you enroll and learn. However, &lt;strong&gt;selecting the most suitable course for yourself&lt;/strong&gt; is a priority, and you should be mindful of the paid classes, considering that many courses are paid. Platforms I recommend for online courses include &lt;strong&gt;Udemy, Coursera, and Skillshare.&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Book
&lt;/h4&gt;

&lt;p&gt;This might not be applicable to everyone, but it's important to note that courses and videos often present topics at a higher, more generalized level. They may not delve deeply into the specifics. Books, on the other hand, &lt;strong&gt;consolidate numerous details in one place, offering content in an ordered manner&lt;/strong&gt;. Similar to choosing a course, finding the most suitable book for yourself is essential.&lt;/p&gt;




&lt;h3&gt;
  
  
  Practicing
&lt;/h3&gt;

&lt;p&gt;That is correct; you've likely heard the saying, &lt;em&gt;"Practice makes perfect."&lt;/em&gt; However, it's crucial to practice in an effective and meaningful way. Practicing in programming doesn't mean simply rewriting code repeatedly, as you might do with other skills. For example, becoming proficient at shooting arrows involves using a bow and arrows repeatedly until you gain the skill and comfort. However, programming doesn't follow the same pattern.&lt;/p&gt;

&lt;p&gt;In programming, &lt;strong&gt;problem-solving&lt;/strong&gt; is the key skill. Essentially, programming is about solving problems using a computer. Initially, this can be an extremely challenging step for every beginner learner. Therefore, practicing programming means actively attempting to solve problems.&lt;/p&gt;

&lt;p&gt;So, where do you find these problems? Initially, you'll encounter problems during your learning process, and these are often relatively straightforward. However, as you progress, it's beneficial to actively seek out more complex problems. I recommend &lt;strong&gt;CodeWars&lt;/strong&gt; because it offers a variety of basic programming challenges, and you can explore other people's solutions in your chosen programming language. CodeWars also supports a wide range of programming languages.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: The vital aspect of this practicing step is to not lose hope and never give up. It certainly takes time, but perseverance is key.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  Doing Project
&lt;/h3&gt;

&lt;p&gt;There is a term that every programmer fears, and that is &lt;em&gt;"Tutorial Hell"&lt;/em&gt; where individuals get stuck watching tutorials without applying their knowledge or theories in the real world. This can be a dangerous trap for those who feel they are not yet perfect to undertake a project.&lt;/p&gt;

&lt;p&gt;The only way to break free from this trap is by working on projects, whether they are small or large, simple or complex. The key is to start and build based on your existing knowledge. Avoid beginning with ambitious projects like creating your own Facebook, especially when you may not yet grasp the basics of the programming language.&lt;/p&gt;

&lt;p&gt;Start with something simple. Believe in the progress you make, and trust in yourself. The question to ask is, "Which project do you need to do?" This is a self-assessment to test your knowledge. However, remember that you need to learn first, practice, and then create projects based on your level of proficiency.&lt;/p&gt;




&lt;p&gt;Absolutely, you can now see the pipeline of the programming journey and &lt;strong&gt;start today&lt;/strong&gt;. Avoid postponing it to tomorrow, as many tend to say, including myself before. Remember, you need to trust yourself. The initial steps may be challenging, but don't give up and go with the flow of progress.&lt;/p&gt;

&lt;p&gt;Good luck, soldiers!&lt;/p&gt;

</description>
      <category>programming</category>
      <category>python</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Recursion : Linear recursion and Tail recursion</title>
      <dc:creator>DamianZoirbile</dc:creator>
      <pubDate>Wed, 13 Oct 2021 16:33:31 +0000</pubDate>
      <link>https://forem.com/showwaiyan/recursion-linear-recursion-and-tail-recursion-5hn5</link>
      <guid>https://forem.com/showwaiyan/recursion-linear-recursion-and-tail-recursion-5hn5</guid>
      <description>&lt;h4&gt;
  
  
  What is Recursion?
&lt;/h4&gt;

&lt;p&gt;In term of computer science, recursion is the calling the function itself. Yes, that all. But it's not simple though.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;Let take an example of the real world&lt;/em&gt;
&lt;/h4&gt;

&lt;p&gt;Have you ever see a photo in the photo of the photo in the photo the.... so on. This is the example of recursion process.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Falgodailyrandomassets%2Fcurriculum%2Frecursion%2Fcover.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.googleapis.com%2Falgodailyrandomassets%2Fcurriculum%2Frecursion%2Fcover.jpg" alt="Recursion process"&gt;&lt;/a&gt;&lt;br&gt;
Above the exapmle, It a exactly single photo in the photo of that photo. Confused???&lt;/p&gt;

&lt;p&gt;Here is the another photo. I named this "Recursive cat". Cute Right? HAHA.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Frecursivelyrecursive.files.wordpress.com%2F2015%2F04%2Fcat.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Frecursivelyrecursive.files.wordpress.com%2F2015%2F04%2Fcat.jpg" alt="Recursive Cat"&gt;&lt;/a&gt;&lt;br&gt;
The photo depict itself in the frame and In this frame the previous photo do the same task.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;So back in computer science&lt;/em&gt;, Recursion is the function calling itself and doing the same things what function does. Recursion Algorithm makes the problem into the sub-problems or smaller problems and compute until the base case. &lt;br&gt;
&lt;em&gt;(What is base case?? I will show you later. Don't worry.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let get into it.&lt;/p&gt;
&lt;h5&gt;
  
  
  There is two recursive process....
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Linear Recursion&lt;/li&gt;
&lt;li&gt;Tail Recursion&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  Linear Recursion
&lt;/h4&gt;

&lt;p&gt;Linear recursion is the normal recursion and It needs to understand before going to the tail recursion. &lt;br&gt;
Let take a look a problem.&lt;/p&gt;

&lt;p&gt;If we wanna write a function that compute the &lt;strong&gt;&lt;em&gt;Factorial&lt;/em&gt;&lt;/strong&gt;, How to solve it??&lt;/p&gt;

&lt;p&gt;Before writing the code, let see what is the &lt;em&gt;Factorial&lt;/em&gt;.&lt;/p&gt;
&lt;h5&gt;
  
  
  Factorial
&lt;/h5&gt;

&lt;p&gt;In Mathematics. &lt;em&gt;Factorial&lt;/em&gt; is the positive integer which is product of a number and less then it. Yes, It look like a series. &lt;em&gt;Factorial&lt;/em&gt; of the number(n) is denoted by &lt;strong&gt;n!&lt;/strong&gt;.&lt;br&gt;
So the &lt;em&gt;Factorial&lt;/em&gt; of 4 is &lt;br&gt;
&lt;code&gt;4! = 4*3*2*1 = 24&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;So the &lt;em&gt;Factorial&lt;/em&gt; is the multiplying of the number-n until to the &lt;strong&gt;one&lt;/strong&gt;.&lt;br&gt;
And the general  formula of &lt;em&gt;Factorial&lt;/em&gt; is&lt;br&gt;
&lt;code&gt;n! = n*(n-1)!&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Let substitute 4 in this Formula&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;4! = 4*3! # (4-1)! is 3!
     4*3*2!
     4*3*2*1! # the value of 1! is 1 so..
     4*3*2
     4*6
     24
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See? the &lt;em&gt;Factorial&lt;/em&gt; number-n multiply until one.&lt;br&gt;
&lt;a href="https://en.wikipedia.org/wiki/Factorial" rel="noopener noreferrer"&gt;More About Factorial&lt;/a&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  Let Code
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;All of the code under is just pseudo code. I will not use any programming languages.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We will write a &lt;em&gt;Factorial&lt;/em&gt; Function named &lt;code&gt;fac()&lt;/code&gt; and it takes one argument &lt;code&gt;n&lt;/code&gt; as parameter. &lt;code&gt;fac(n)&lt;/code&gt; compute &lt;em&gt;n!&lt;/em&gt; .&lt;br&gt;
How to compute??&lt;br&gt;
The formula of Factorial is &lt;code&gt;n! = n*(n-1)!&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;So the function &lt;code&gt;fac(n)&lt;/code&gt; return the answer of n! computing &lt;code&gt;n*(n-1)!&lt;/code&gt; until to one.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fac(n) = n * fac(n-1) 
# fac(n-1) means (n-1)!

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

&lt;/div&gt;



&lt;h6&gt;
  
  
  Here is the problem!!!
&lt;/h6&gt;

&lt;p&gt;This function &lt;code&gt;fac(n)&lt;/code&gt; doesn't execute until one. It will run forever  before stack memory is full.&lt;br&gt;
Because &lt;code&gt;fac(n)&lt;/code&gt; call itself forever even it will reach &lt;em&gt;one&lt;/em&gt;. &lt;br&gt;
When it reach one&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fac(1-1)
fac(0) 
fac(-1) # fac(0-1)
.........so on
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It goes forever and when the stack memory full, it will rise an error. Also it will never give a result.And the Factorial of -1 makes non-sense.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Solution is &lt;em&gt;Base Case&lt;/em&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;What is a actually &lt;em&gt;Base Case&lt;/em&gt;.&lt;br&gt;
It means that when the function recursion reach &lt;em&gt;Base Case&lt;/em&gt; the program must stop and return the result to previous function recursion.&lt;/p&gt;

&lt;p&gt;For our problem, the &lt;em&gt;Base Case&lt;/em&gt; is &lt;em&gt;one&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;So, Here is our function definition again..&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fac(n) = if n == 1
           return 1
         else n * fac(n-1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let excute &lt;code&gt;fac(4)&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fac(4)
= 4 * (fac(3))
= 4 * (3 * (fac(2)))
= 4 * (3 * (2 * (fac(1))) 
# So we reach the Base Case one and return the result one
= 4 * (3 * (2 * (1)))
= 4 * (3 * (2))
= 4 * (6)
= 24
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At that time, the program will not run forever and when it reach base case, it will return 1.&lt;/p&gt;

&lt;p&gt;That is linear recursion.&lt;/p&gt;

&lt;p&gt;But the linear recursion has a big problem.&lt;br&gt;
Yes, Efficiency.&lt;br&gt;
How about if you wanna know the Factorial of &lt;em&gt;100000&lt;/em&gt;.&lt;br&gt;
Ohh..goddd... A Huge Number!!!!&lt;br&gt;
In this case, Stack Over Flow error will rise. Because if &lt;em&gt;Factorial&lt;/em&gt; of 4 even takes many steps, How many steps does &lt;em&gt;100000&lt;/em&gt; takes??&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fac(100000)
= 100000 * (fac(99999))
= 100000 * (99999 * (fac(99998)))
= 100000 * (99999 * (99998 * (fac(99997))))
# ...... so on!!!!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See the Problem??&lt;br&gt;
The Stack memory will be full at some steps and can't call next recursion. So, stack over flow error will rise.&lt;/p&gt;

&lt;p&gt;It will use a lot of Memory and not efficient. It will go to the base case and come back to the recursion. So, it will expand the function call stack just like above the code.&lt;/p&gt;

&lt;p&gt;What does it look like?&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2j034n0454eq60aq143w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2j034n0454eq60aq143w.png" alt="Linear Recursion Example"&gt;&lt;/a&gt;&lt;br&gt;
Exactly, Linear recursion looks like your workdays. On Monday, you may think "I don't need to do right now. Now I'm gonna to chill. Ok!!!". Next day, You also do the same as yesterday and next day by day. On Friday, You have a lot of things to do. It's Friday but you can't happy for weekend. &lt;br&gt;
Also Linear Recursion wait the result until it reach the base case. When you call Factorial of 100000, the computer will kick off and smash you. I'm sure.&lt;br&gt;
That is the problem of Linear Recursion.&lt;/p&gt;
&lt;h4&gt;
  
  
  Tail Recursion
&lt;/h4&gt;

&lt;p&gt;In Tail Recursion, Something new  happen and a  little bit change.&lt;br&gt;
We also declare &lt;em&gt;Factorial&lt;/em&gt; function &lt;code&gt;fac()&lt;/code&gt;. But now we will take two argument as parameter, number(&lt;code&gt;n&lt;/code&gt;) and accumulator(&lt;code&gt;a&lt;/code&gt;). Accumulator is doing the task which takes the result of &lt;em&gt;Factorial&lt;/em&gt; instead of going until base case. And Accumulator &lt;code&gt;a&lt;/code&gt; is initialize 1 at first&lt;/p&gt;
&lt;h5&gt;
  
  
  Let Code
&lt;/h5&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fac(n,a=1) = fac(n-1,a*n)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Hey,Don't forget the &lt;em&gt;Base Case&lt;/em&gt;. It is very curial in Recursion.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fac(n,a=1) = if n == 1
             return a
           else fac(n-1,n*a)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let excute &lt;code&gt;fac(4,a=1)&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fac(4,a=1)
fac(3,a=4) # a=1 and 1*4 is 4
fac(2,a=12) # a=4 and 3*4 is 12
fac(1,a=24) # a=12 and 2*12 is 24
# Here is our base case and return a which is 24
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Tail recursion, &lt;em&gt;Factorial&lt;/em&gt; function doesn't expand the function order and efficient than the Linear Recursion.&lt;/p&gt;

&lt;p&gt;So, I hope you have a little knowledge about recursion and recursive processes.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;All of the above are not the whole theory.It is just a knowledge sharing and a piece of tiny concept. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;If something wrong, please inform &lt;em&gt;&lt;a href="mailto:showwaiyan555@gmail.com"&gt;showwaiyan555@gmail.com&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=_JtPhF8MshA&amp;amp;t=593s" rel="noopener noreferrer"&gt;Here is the reference&lt;/a&gt;&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>programming</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Applicative order Vs Normal order</title>
      <dc:creator>DamianZoirbile</dc:creator>
      <pubDate>Wed, 21 Jul 2021 14:14:18 +0000</pubDate>
      <link>https://forem.com/showwaiyan/applicative-order-vs-normal-order-1dj</link>
      <guid>https://forem.com/showwaiyan/applicative-order-vs-normal-order-1dj</guid>
      <description>&lt;p&gt;Yeah, the Topic is a little weird. You ever heard static language and dynamic language. So, this topic looks like the same static vs dynamic language.&lt;/p&gt;

&lt;h2&gt;
  
  
  Functional programming
&lt;/h2&gt;

&lt;p&gt;In Functional programming, the evaluation of an expression rewrites the canonical form into the order(&lt;strong&gt;Evaluation Order&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;What is rewriting the function??&lt;br&gt;
It’s replacing the function body with the function call.&lt;br&gt;
Eg Code Block:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//if the function the double the number
double x = x + x;
//if we call this function with a number
double 4
//It replaces by the body of the function "x + x" with argument
double 4 =&amp;gt; 4 + 4
//so the answer is 8

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

&lt;/div&gt;



&lt;h5&gt;
  
  
  This is the evaluation of the function.
&lt;/h5&gt;




&lt;h2&gt;
  
  
  Evaluation Order
&lt;/h2&gt;

&lt;p&gt;There's two important order rewriting.&lt;br&gt;
1.Normal order&lt;br&gt;
-&amp;gt;It rewrites or execute leftmost occurrence of a function.&lt;br&gt;
2.Applicative order&lt;br&gt;
-&amp;gt;It rewrites or execute innermost occurrence of a function.&lt;/p&gt;
&lt;h3&gt;
  
  
  Let do some codes
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//the function double the number
double x = x + x;
//the function average the two number
average x y = (x + y) / 2;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;To avoid confusing the concept, let re-express operator function "+" , "*" and "/".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//so the function double change into 
double x = plus x x //change expression num1 + num2
//so the function average change into
average x y = divide (plus x y) 2 //change expression num1 / num2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Let evaluate double(average 2 4)&lt;/p&gt;

&lt;h2&gt;
  
  
  Normal Order
&lt;/h2&gt;

&lt;p&gt;Normal order execute leftmost part of function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;double (average 2 4) =&amp;gt;
plus (average 2 4) (average 2 4) =&amp;gt;
plus (divide (plus 2 4) 2) (average 2 4) =&amp;gt;
plus (divide 6 2) (average 2 4) =&amp;gt;
plus 3 (average 2 4) =&amp;gt;
plus 3 (divide (plus 2 4) 2) =&amp;gt;
plus 3 (divide 6 2) =&amp;gt;
plus 3 3 =&amp;gt;
6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Applicative Order
&lt;/h2&gt;

&lt;p&gt;Applicative Order execute innermost part of function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; double (average 2 4) =&amp;gt;
 double (divide (plus 2 4) 2) =&amp;gt;
 double (divide 6 2) =&amp;gt;
 double 3 =&amp;gt;
 plus 3 3 =&amp;gt;
 6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;So, We see. Normal order evaluate many steps and  it is a delay evaluation. It is &lt;strong&gt;lazy evaluation&lt;/strong&gt;.&lt;br&gt;
Applicative Order takes the few steps.&lt;/p&gt;

&lt;p&gt;So, This is &lt;strong&gt;Applicative order languages&lt;/strong&gt; vs &lt;strong&gt;normal order languages&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://courses.cs.washington.edu/courses/cse505/99au/functional/applicative-normal.pdf"&gt;Here is the reference link&lt;/a&gt;&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
