<?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[Stories by Amruha Ahmed on Medium]]></title>
        <description><![CDATA[Stories by Amruha Ahmed on Medium]]></description>
        <link>https://medium.com/@amruha.ahmed?source=rss-240a314d423------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*z7T-QslU7YXj0R65u5WFww.jpeg</url>
            <title>Stories by Amruha Ahmed on Medium</title>
            <link>https://medium.com/@amruha.ahmed?source=rss-240a314d423------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 04:01:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@amruha.ahmed/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Experience as a Data Analytics Intern at Oasis Infobyte]]></title>
            <link>https://medium.com/@amruha.ahmed/experience-as-a-data-analytics-intern-at-oasis-infobyte-0d3a16e6d651?source=rss-240a314d423------2</link>
            <guid isPermaLink="false">https://medium.com/p/0d3a16e6d651</guid>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[internship-experience]]></category>
            <category><![CDATA[intern]]></category>
            <dc:creator><![CDATA[Amruha Ahmed]]></dc:creator>
            <pubDate>Mon, 20 May 2024 12:53:12 GMT</pubDate>
            <atom:updated>2024-05-20T12:53:12.808Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6leACXHPbXyFEk12iLGbqw.jpeg" /></figure><p>Perseverance. Learning. Growth.</p><p>This is how I would like to describe my stint as a Data Analytics Intern at <a href="https://www.oasisinfobyte.com/">Oasis Infobyte</a>. This remote internship spanning 1st May till 5th June helped me hone not only my data analytics skills but also my data cleaning, feature engineering and data visualization skills.</p><p>During this internship, I completed 3 tasks:</p><ol><li>Exploratory Data Analysis (EDA) on Retail Sales Data</li><li>Data Cleaning on New York City Airbnb Listings</li><li>Analyzing Google Play Store Data</li></ol><h3>Task 1 : Exploratory Data Analysis on Retail Sales Data</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-dh8tcArXd477Ks_1DGB8A.jpeg" /></figure><p>I performed an extensive Exploratory Data Analysis based on the sales data collected from 10 different shopping malls of Istanbul, Turkey. I utilized different parameters such as mall type, location and age groups to derive panoramic insights from the data.</p><p>The analysis involved a wide array of tasks such as data loading, cleaning, feature engineering, descriptive statistics and data visualization.</p><p>Here are the top 5 insights I have gathered : <br>◼ Highest number of invoices are billed during the month of October <br>◼ The invoices are dominated by purchases from mega malls <br>◼ Clothing emerges as the most popular category among all the invoices <br>◼ On an average, a customer purchases 3 items of any type from the shopping malls <br>◼ Majority of the payments are done in cash.</p><p><a href="https://www.linkedin.com/posts/amruha-ahmed_oasisinfobyte-intern-internship-activity-7194752879071571969-efTM/?utm_source=share&amp;utm_medium=member_desktop"><strong>LinkedIn Post</strong></a></p><h3>Task 2: <strong>Data Cleaning on New York Airbnb Listings</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jq5KC7hZ4NjCo3COoFAXYQ.jpeg" /></figure><p>I made use of a dataset related to the Airbnb listings and metrics in New York City from the public domain to carry out this task.</p><p>I employed various techniques to clean the data such as data imputation, date parsing, outlier detection and handling, text preprocessing, label encoding, column removal and min max scaling.</p><p><a href="https://www.linkedin.com/posts/amruha-ahmed_data-oasisinfobyte-intern-activity-7194780743552679936-T5Am/?utm_source=share&amp;utm_medium=member_desktop"><strong>Linked In Post</strong></a></p><h3>Task 3: Analyzing Google Play Store Data</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TOCml2E6jvSu5DzWAS42dw.jpeg" /></figure><p>I performed a meticulous Exploratory Data Analysis on Google Play Store Data.</p><p>I utilized a plethora of parameters related to the apps such as categories, ratings , reviews and sentiments to gain relevant insights about the apps.</p><p>Here are the top 5 insights I have gathered: <br>◼ Majority of the apps belong to the “family” category followed by “games” and “tools” categories. <br>◼ The average size of each app listed is 20.41 MB .<br>◼ Free apps occupy slightly more size on an average as compared to paid apps. <br>◼ Most of the reviews evoke a positive sentiment. <br>◼ Finance apps, followed by lifestyle apps have the highest prices on an average among all categories.</p><p><a href="https://www.linkedin.com/posts/amruha-ahmed_oasisinfobyte-intern-internship-activity-7194788290175115264-cego/?utm_source=share&amp;utm_medium=member_desktop"><strong>Linked In Post</strong></a></p><p>I am truly grateful to <a href="https://www.oasisinfobyte.com/">Oasis Infobyte</a> for giving me this great opportunity to polish my skills and gain a deeper understanding of data analytics.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0d3a16e6d651" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Affine Cipher in Java]]></title>
            <link>https://medium.com/@amruha.ahmed/affine-cipher-in-java-8a1896a96df2?source=rss-240a314d423------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a1896a96df2</guid>
            <category><![CDATA[cipher]]></category>
            <category><![CDATA[encryption]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[cryptography]]></category>
            <dc:creator><![CDATA[Amruha Ahmed]]></dc:creator>
            <pubDate>Wed, 03 Apr 2024 17:02:15 GMT</pubDate>
            <atom:updated>2024-04-03T17:03:33.589Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WHIqfmxZWkwbXqu8.png" /></figure><p>Affine cipher is a simple encryption technique that follows monoalphabetic substitution. This cipher converts plaintext to ciphertext by making use of the numerical equivalent of alphabets . The formula used for encryption is:</p><blockquote><strong>ciphertext=((a*plaintext)+b)%26</strong></blockquote><p>Where the plaintext refers to numerical equivalent of the plaintext alphabet(such as 0 for A, 1 for B and so on ). Ciphertext refers to the numerical equivalent of the ciphertext alphabet. ‘a’ is the multiplier and ‘b’ is the additive shift value. Both ‘a’ and ‘b’ serve as keys to this encryption technique.</p><p>The value obtained from ciphertext will be converted to the equivalent character.</p><p>Though relatively easy to understand and implement, affine cipher is shadowed by more secure encryption techniques.</p><h3><strong>Arrays used in the Affine Cipher Program:</strong></h3><p>1.<strong>alpha</strong>-array of alphabets from A to Z</p><p>2.<strong>number</strong>-array of numerical equivalent of alphabets</p><h3><strong>Variables used in the Affine Cipher Program:</strong></h3><p>1.<strong>a</strong> — multiplier</p><p>2.<strong>b</strong> — additive shift value</p><p>3.<strong>plaintext</strong> — to store the plaintext given by the user</p><p>4.<strong>ciphertext</strong> — to store the ciphertext generated after computation</p><p>5.<strong>i</strong> — loop counter</p><p>6.<strong>j</strong> — loop counter</p><p>7.<strong>start</strong> — starting character in alpha array</p><p>8.<strong>cc</strong> — storing ciphertext of current letter</p><p>9.<strong>pos</strong> — stores numerical equivalent of character</p><p>10.<strong>c</strong> — to store the current character of the plaintext</p><h3><strong>Algorithm for Affine Cipher:</strong></h3><p>1.Start</p><p>2.Accept the values of ‘a’ , ‘b’ and the plaintext from the user</p><p>3.Convert the plaintext to uppercase</p><p>4.Initialize the number array with the numerical equivalent of each alphabet such as 0-&gt; A, 1-&gt;B ….. 25-&gt;Z and store the corresponding alphabets in the alpha array</p><p>5.Until j is less than the length of plaintext, repeat the steps from 6 to 10</p><p>6.Get the current character of plaintext and store in c</p><p>7.Initialize pos to 0</p><p>8.Find numerical equivalent of character ‘c’ and store it in pos</p><p>9.Calculate the numerical equivalent of cipher text using the formula ((a*pos)+b)%26 and store it in cc</p><p>10.Include the encrypted character into the ciphertext string by concatenating alpha[cc] (alphabet corresponding to cc numerical value) to ciphertext</p><p>11.Display ciphertext</p><p>12.Stop</p><h3><strong>Program:</strong></h3><pre><br>import java.util.*;<br>class affinecipher<br>{<br>    Scanner ob=new Scanner(System.in);<br>    void main()<br>    {<br>        int a,b;// a- multiplier, b-additive shift value<br>        String plaintext,ciphertext=&quot;&quot;;//to store plaintext and cipher text respectively<br>        int i,j;//i and j are loop counters<br>        int cc,pos;//cc- storing ciphertext of current letter, pos-stores numerical equivalent of character<br>        char start=&#39;A&#39;;//starting character in alpha array<br>        int number[]=new int[26];//array of numerical equivalent of alphabets<br>        char alpha[]=new char[26];//array of alphabets from A to Z<br>        System.out.print(&quot;Enter the multiplier &#39;a&#39;:&quot;);<br>        a=ob.nextInt();<br>        System.out.print(&quot;Enter the additive shift &#39;b&#39;:&quot;);<br>        b=ob.nextInt();<br>        System.out.print(&quot;Enter the plaintext:&quot;);<br>        plaintext=ob.next(); <br>        plaintext=plaintext.toUpperCase();<br>        for(i=0;i&lt;26;i++)<br>        {//storing current alphabet in alpha and its numerical equivalent in number<br>            number[i]=i;<br>            alpha[i]=start;<br>            start++;<br>        }<br>        for(j=0;j&lt;plaintext.length();j++)<br>        {<br>            char c=plaintext.charAt(j); //getting the current character of plaintext<br>            pos=0;<br>            for(i=0;i&lt;alpha.length;i++)<br>            {//finding numerical equivalent of &#39;c&#39;<br>              if(c==alpha[i])<br>              {<br>                  pos=i;<br>                  break;<br>                }                <br>            }<br>            cc=((a*pos)+b)%26;//calculating ciphertext of alphabet &#39;c&#39;     <br>            ciphertext=ciphertext+&quot;&quot;+alpha[cc];//updating the ciphertext string         <br>        }<br>        System.out.println(&quot;The cipher text is &quot;+ciphertext);<br>    }<br>}             </pre><h3>Dry Run:</h3><p>Suppose if the user enters plaintext as “SECRET”, ‘a’ as 5 and ‘b’ as 8 , then the computation is carried out as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EZVQu8lrGzT_0LSP.png" /></figure><p>The final cipher text obtained is UCSPCZ</p><h3><strong>Output:</strong></h3><p>Enter the multiplier ‘a’:5</p><p>Enter the additive shift ‘b’:8</p><p>Enter the plaintext: SECRET</p><p>The cipher text is UCSPCZ</p><p><em>Originally published at </em><a href="https://codingjoy.netlify.app/affinecipher"><em>https://codingjoy.netlify.app</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a1896a96df2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pell Numbers in Java]]></title>
            <link>https://medium.com/@amruha.ahmed/pell-numbers-in-java-b9e9060ad478?source=rss-240a314d423------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9e9060ad478</guid>
            <category><![CDATA[loop]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[loops-in-java]]></category>
            <category><![CDATA[sequence]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Amruha Ahmed]]></dc:creator>
            <pubDate>Thu, 25 Jan 2024 22:01:34 GMT</pubDate>
            <atom:updated>2024-01-25T22:01:34.765Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3YzzQCug-4uIDg2MJZNAfg.png" /></figure><p>Pell Numbers are a sequence of integers which can be generated using the formula :</p><blockquote><strong>Pn=0 for n=0</strong></blockquote><blockquote><strong>Pn=1 for n=1</strong></blockquote><blockquote><strong>Pn= 2 Pn-1+Pn-2 for n&gt;1</strong></blockquote><p>Pell Numbers are immensely useful in error-correction codes and cryptographic algorithms.</p><h3><strong>Variables Required:</strong></h3><ul><li><strong>p0:</strong> to store the first term of the sequence</li><li><strong>p1:</strong> to store the second term of the sequence</li><li><strong>p2:</strong> to store the n’th term of the sequence</li><li><strong>ctr:</strong> to store the count of numbers printed on screen</li><li><strong>n:</strong> number of terms to be printed on screen</li></ul><h3><strong>Algorithm:</strong></h3><p>1.Start</p><p>2.Initialize the values of p0,p1,pn and ctr as 0,1,0,0 respectively</p><p>3.Accept the number of terms from the user and store in ‘n’</p><p>4.If n is 0 then go to step 10 otherwise step 5</p><p>5.If n=1 then print p0 and go to Step 10 . Otherwise go to step 6</p><p>6.If n=2 then print p0 and p1 and go to step 10 . Otherwise go to step 7</p><p>7.Display the values of p0 and p1</p><p>8.Update value of ctr to 2</p><p>9.While ctr is less than n, repeat the following steps, otherwise go to step 10</p><p>(i) calculate pn as 2*p1+p0</p><p>(ii) display pn</p><p>(iii)update values of p0 as p1 and p1 as pn</p><p>(iv) increment ctr by 1</p><p>10.Stop</p><h3><strong>Program:</strong></h3><pre>import java.util.*;<br>class pellnumber {<br>    Scanner ob = new Scanner(System.in);<br>    void main() {<br>        int p0 = 0; //first term of the sequence<br>        int p1 = 1; //second term of the sequence<br>        int pn = 0; //n&#39;th term of the sequence<br>        int ctr = 0; //to store the count of numbers printed on screen<br>        int n; //number of terms to be printed<br>        System.out.print(&quot;\n Enter the number of terms:&quot;);<br>        n = ob.nextInt();<br>        System.out.println(&quot;\n The pell numbers are ....\n&quot;);<br>        if (n == 0) {<br>            System.out.print(&quot;\n Wrong input&quot;);<br>            System.exit(1);<br>        } else if (n == 1) {<br>            System.out.print(&quot;  &quot; + p0);<br>            System.exit(0);<br>        } else if (n == 2) {<br>            System.out.print(&quot;  &quot; + p0 + &quot;  &quot; + p1);<br>            System.exit(0);<br>        } else // for n&gt;2<br>        {<br>            System.out.print(&quot;  &quot; + p0 + &quot;  &quot; + p1);<br>            ctr = 2;<br>            while (ctr &lt; n) // to generate the next pell numbers<br>            {<br>                pn = 2 * p1 + p0; //calculating the n&#39;th pell number <br>                System.out.print(&quot;  &quot; + pn);<br>                //updating values of p0 and p1 for the next iteration<br>                p0 = p1;<br>                p1 = pn;<br>                ctr++; //updating count of terms printed<br>            }<br>        }<br><br>    }<br>}</pre><h3><strong>Dry Run:</strong></h3><p>Supposing ‘n’ is given as 5 and p0=0, p1=1, pn=0 and ctr=0 initially then:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CfKju34eHQ_N8evY.png" /></figure><h3><strong>Output:</strong></h3><p>Enter the number of terms: 5</p><p>The pell numbers are ….</p><p>0 1 2 5 12</p><p><em>Originally published at </em><a href="https://codingjoy.netlify.app/pellnumberjava"><em>https://codingjoy.netlify.app</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9e9060ad478" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hourglass Pattern in C Language]]></title>
            <link>https://medium.com/@amruha.ahmed/hourglass-pattern-in-c-language-ab2036ddf681?source=rss-240a314d423------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab2036ddf681</guid>
            <category><![CDATA[nested-loop]]></category>
            <category><![CDATA[patterns]]></category>
            <category><![CDATA[loops-in-c]]></category>
            <category><![CDATA[c]]></category>
            <dc:creator><![CDATA[Amruha Ahmed]]></dc:creator>
            <pubDate>Thu, 18 Jan 2024 01:41:34 GMT</pubDate>
            <atom:updated>2024-01-18T01:41:34.419Z</atom:updated>
            <content:encoded><![CDATA[<p>This article will help you create an hourglass pattern in C language which can be generated using nested loops.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*271diOmN63jYiFsSsuaFBQ.jpeg" /></figure><h3>Delving Deeper:</h3><p>1.The hourglass pattern requires the usage of nested loops to print “*” in the appropriate manner as shown</p><p>2.One separate variable is required to keep in check the number of asterisks printed on the screen.</p><p>3.Another variable is required to keep track of the number of spaces printed on the screen.</p><h3>Break-Up of the Upper Half of the Pattern:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*PXljAmpSnjkBtwCZhdsZ1g.jpeg" /></figure><p>1. 6 rows need to be printed in the upper half of the pattern</p><p>2. The dashes are an indication of the spaces required. The number of dashes outside the pattern are stored in variable “s”. Before starting the outer loop, “s” is initialized to 0. As observed from the image given above, the number of spaces keeps on increasing by 1 after each iteration. These spaces indicated by “s” are printed in the current row.<br><strong>NOTE: Value of “s” depends upon the number of rows to be printed on the screen</strong></p><p>3.The number of asterisks to be printed in the current row are denoted by “m”. Before starting the loop, “m” is initialized to 11.As inferred from the image above, the number of asterisks keeps on decreasing by 2 after each iteration.<br><strong>NOTE: Value of “m” depends upon the number of rows to be printed on the screen</strong></p><h3>Break-Up of the Lower Half of the Pattern:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*DqUSgrUUQmw06rePnkTviw.jpeg" /></figure><p>1.The lower half of the pattern has 5 rows.</p><p>2. The dashes are an indication of the spaces required. The number of dashes outside the pattern are stored in variable “s”. Before starting the outer loop, “s” is initialized to 4. As observed from the image given above, the number of spaces keeps on decreasing by 1 after each iteration. These spaces indicated by “s” are printed in the current row.<br><strong>NOTE: Value of “s” depends upon the number of rows to be printed on the screen</strong></p><p>3.The number of asterisks to be printed in the current row are denoted by “m”. Before starting the outer loop, “m” is initialized to 3.As inferred from the image above, the number of asterisks keeps on increasing by 2 after each iteration.<br><strong>NOTE: Value of “m” depends upon the number of rows to be printed on the screen</strong></p><h3>Program:</h3><pre>#include&lt;stdio.h&gt;<br>void main() <br>{<br>  int m = 11; //number of asterisks to be printed<br>  int s = 0; // number of spaces<br>  int i, j; //i-outer loop counter, j-inner loop counter<br>  //upper half of the pattern<br>  for (i = 1; i &lt;= 6; i++)<br>  {<br>    for (j = 1; j &lt;= s; j++)<br>    printf(&quot;  &quot;);<br>    for (j = 1; j &lt;= m; j++)<br>    printf(&quot;* &quot;);<br>    s++;<br>    m -= 2;<br>    printf(&quot;\n&quot;);<br>  }<br>  m = 3;<br>  s = 4;<br>  //lower half of the pattern<br>  for (i = 1; i &lt;= 5; i++)<br>  {<br>    for (j = 1; j &lt;= s; j++)<br>    printf(&quot;  &quot;);<br>    for (j = 1; j &lt;= m; j++)<br>    printf(&quot;* &quot;);<br>    s--;<br>    m += 2;<br>    printf(&quot;\n&quot;);<br>  }<br>}</pre><h3>Output:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/237/1*VOM81gTCMOPNKWegO8Kjfw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab2036ddf681" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Split Pyramid Pattern in Java]]></title>
            <link>https://medium.com/@amruha.ahmed/split-pyramid-pattern-in-java-35cc666f32dc?source=rss-240a314d423------2</link>
            <guid isPermaLink="false">https://medium.com/p/35cc666f32dc</guid>
            <category><![CDATA[loops-in-java]]></category>
            <category><![CDATA[loop]]></category>
            <category><![CDATA[patterns]]></category>
            <category><![CDATA[pyramid-pattern]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Amruha Ahmed]]></dc:creator>
            <pubDate>Wed, 17 Jan 2024 11:26:50 GMT</pubDate>
            <atom:updated>2024-01-17T11:26:50.371Z</atom:updated>
            <content:encoded><![CDATA[<p>This article will aid you in the creation of a split pyramid pattern in Java using a combination of nested loops.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/0*iXfcR4uhqJumzbJ9.jpeg" /></figure><h3><strong>Delving Deeper:</strong></h3><ol><li>This pattern requires the usage of nested loops to print the asterisks in the appropriate manner</li><li>One separate variable is required to check the number of spaces printed on the screen before the asterisks are printed</li></ol><h3><strong>Break-up of the pattern:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/0*Y8Jzot6xY1o9Za-j.jpeg" /></figure><p>1.A total of 7 rows need to be printed in the pattern.</p><p>2.On each side of the split, the asterisks keep increasing by 1 after each iteration.</p><p>3.The dashes are an indication of spaces required. Before the outer loop begins, the space variable is initialized to 7 i.e. the number of rows of asterisks to be printed on the screen. As observed from the above pattern, the spaces keep decreasing by 1 after each iteration.</p><p>4.The set of asterisks on the left side of the split are printed on the screen depending on the value of the outer loop counter.</p><p>5.A space is printed on the screen to impart the split look to the pyramid.</p><p>6.The number of asterisks to be printed on the right side of the split are determined by the value of the outer loop counter.</p><h3>Program:</h3><pre>class splitpyramid<br>{<br>    void main()<br>    {<br>         int s=7;//number of spaces to be printed<br>         int i,j;//loop counters<br>         for(i=1;i&lt;=7;i++)<br>         {<br>             for(j=1;j&lt;=s;j++)<br>             {<br>                 System.out.print(&quot;  &quot;);<br>             }<br>             for(j=1;j&lt;=i;j++)<br>             {<br>                 System.out.print(&quot;* &quot;);<br>             }<br>             System.out.print(&quot; &quot;);<br>             for(j=1;j&lt;=i;j++)<br>             {<br>                 System.out.print(&quot;* &quot;);<br>             }<br>             System.out.println();<br>             s--;<br>           }<br>    }<br>}</pre><h3><strong>Output:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/0*-NzxKMw8dCgxa9JX.jpeg" /></figure><p><em>Originally published at </em><a href="https://codingjoy.netlify.app/splitpyramidjava"><em>https://codingjoy.netlify.app</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35cc666f32dc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chocolate Ratings Analysis Using Tableau]]></title>
            <link>https://medium.com/@amruha.ahmed/chocolate-ratings-analysis-using-tableau-515683af3bc2?source=rss-240a314d423------2</link>
            <guid isPermaLink="false">https://medium.com/p/515683af3bc2</guid>
            <category><![CDATA[chocolate]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[tableau]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Amruha Ahmed]]></dc:creator>
            <pubDate>Tue, 16 Jan 2024 18:37:07 GMT</pubDate>
            <atom:updated>2024-01-20T06:02:17.630Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Zo4DSUt0jIhxU5uX7LcWQ.jpeg" /></figure><p>Chocolate has weaved its way into our cultural fabric. This popular snack is enjoyed by young and old alike.</p><p>Having a sweet tooth myself, I decided to analyze the ratings of chocolates to understand what exactly makes them tick. Is it based on the manufacturer? Or is it the Cocoa Percentage? Or something else?</p><p>Lets delve deep into this problem using Tableau.</p><h3>About the Dataset:</h3><p>I have used the following dataset from Kaggle:</p><p><a href="https://www.kaggle.com/datasets/andrewmvd/chocolate-ratings?select=chocolate_ratings.csv">https://www.kaggle.com/datasets/andrewmvd/chocolate-ratings?select=chocolate_ratings.csv</a></p><p>The columns are :</p><ol><li>REF (or the ID of the chocolate)</li><li>Company (Manufacturer of the chocolate)</li><li>Company Location</li><li>Review Date</li><li>Country of Bean Origin</li><li>Specific Bean Origin or Bar Name</li><li>Cocoa Percent</li><li>Ingredients</li><li>Most Memorable Characteristics</li><li>Rating</li></ol><h3>Data Preparation:</h3><ol><li>I created a calculate field of “Cocoa Percentage” from “Cocoa Percent” Attribute by multiplying Cocoa Percent with 100 to bring the attribute in percentage form.</li><li>I changed the geographic role of Company Location to “Country/Region” since it was initially given in text format.</li></ol><h3>Analyzing the Manufacturers in the Chocolate Industry:</h3><h4>Top 10 Most Popular Chocolate Manufacturers:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*B-64h8crVNgKkPMY" /></figure><p>I began the analysis by taking the count of records as columns and company i.e. manufacturer as rows</p><p>Then I applied a filter to get the Top 10 most popular manufacturers or those manufacturers who occur the most number of times in the table.</p><h4>Analyzing the Prominent Cocoa Percentages:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LQ0r7gTv3eJJiOcr" /></figure><p>To create this line chart, I took the Cocoa Percentage attribute as columns and count of records as rows.</p><p>Then I added a dropdown filter for the Company(Manufacturer) so that the graph is adjusted accordingly whenever I choose a particular company.</p><h4>Analyzing the Trends in Ratings:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PfO2MABCPzKNL7iQ" /></figure><p>In order to make this line chart, I took the Rating attribute as columns and the count of records as rows.</p><p>Then I added a dropdown filter for the Company(Manufacturer) so that the graph is adjusted accordingly whenever I choose a particular company.</p><h4>Average Rating of the Manufacturer:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*P9M1FV4yUKawPcUY" /></figure><p>In order to get this metric, I considered the average rating as “Text” and added a Company(Manufacturer) filter so that the value in the text box changes for each company chosen.</p><h4>Total Number of Manufacturers:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/0*XSI0fhjicCXKxYQ7" /></figure><p>To get this metric, I took the distinct count of manufacturers as “Text”.</p><h4>Dashboard:</h4><p>To combine all the information pertaining to the manufacturers in the chocolate industry, I created the following dashboard:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dEkfbR_TIn7RJh94" /></figure><h4>Inferences from the Dashboard:</h4><ol><li>Soma is the most popular chocolate manufacturer</li><li>Majority of the chocolates have 70% of cocoa percentage</li><li>A vast amount of chocolates have a rating of 3.5 followed by 3.0</li><li>The average rating of manufacturers is 3.196</li></ol><h3>Analyzing the Countries Involved in the Chocolate Industry:</h3><h4>Top 5 Most Popular Company Locations:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/0*iK1bABD6XfsSRNEx" /></figure><p>To get the company locations, I made a bubble chart by taking the Company Location as “Text” and count of records in “Size”.</p><p>In order to get the top locations, I created a filter on the Company Location for the top 5 locations.</p><h4>Analyzing the Country of Bean Origin:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NXutf8bjbK18MnOv" /></figure><p>To make this map, I took the Latitude and Longitude as rows and columns respectively. Then I dragged the country of Bean Origin into detail and the count of records into color.</p><h4>Trends in Ratings Based on the Country of Bean Origin:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JMI8q1EzIHb_6T8v" /></figure><p>In order to make this line chart, I took the Rating attribute as columns and the count of records as rows.</p><p>Then I added a dropdown filter for the Country of Bean Origin so that the graph is adjusted accordingly whenever I choose a particular country.</p><h4>Assessing the Cocoa Percentages based on the Country of Bean Origin:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d5TmT_3buSCjxTTx" /></figure><p>To create this line chart, I took the Cocoa Percentage attribute as columns and count of records as rows.</p><p>Then I added a dropdown filter for the Country of Bean Origin so that the graph is adjusted accordingly whenever I choose a particular country.</p><h4>Dashboard:</h4><p>To combine all the graphs pertaining to the countries involved in the chocolate industry, I have created the following dashboard:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EKEf6PV9vk-I51Qc" /></figure><h4>Inferences from the Dashboard:</h4><ol><li>USA is the most popular company location.</li><li>Venezuela and Peru, followed by Ecuador are the most prominent countries in bean origin.</li></ol><h3>Analyzing the Contents of Chocolates:</h3><h4>Top 5 Most Popular Ingredients:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/0*P7ueTPMrLkKQFWng" /></figure><p>To make this bar chart, I took the Ingredients attribute as columns and count of records as rows.</p><p>Then I created a filter for the Top 5 ingredients based on the count of records.</p><h4>Analyzing the Average Rating of Ingredients:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*un8hoWfU456nyi6z" /></figure><p>I took the average rating as columns and the ingredients as rows. Then I created a filter for the top 10 ingredients having the highest averages to declutter the graph.</p><h4>Top 10 Most Memorable Characteristics of Chocolates:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*M6BiU-ULIglg-KIA" /></figure><p>In order to make this graph, I took the count of records as rows and the “Most Memorable Characteristics” attribute as columns.</p><p>Then I applied a filter on the characteristics attribute to obtain the top 10 characteristics.</p><h4>Total Number of Ingredients Considered:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/0*AaUPzHobDxBov8H-" /></figure><p>To obtain this metric, I took the distinct count of ingredients as “Text”.</p><h4>Total Number of Chocolate Characteristics:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/0*S6aLhwnjwfhh1nfB" /></figure><p>To obtain this metric, I took the distinct count of “Most Memorable Characteristics” attribute as “Text”.</p><h4>Dashboard:</h4><p>To combine all the information pertaining to the contents of chocolates in a single place, I have made the following dashboard:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_W3E_2DJe4j6IoRM" /></figure><h4>Inferences from the Dashboard:</h4><ol><li>3-B,S,C is the most popular ingredient in chocolates.</li><li>3-B,S,C has the highest average rating among all other ingredients.</li><li>“spicy, cocoa” and “creamy, nutty, cocoa” are the most memorable characteristics of chocolates.</li></ol><p>Found this article interesting? Give it a like and share it with your friends !!</p><p>#data #datascience #dataanalysis #dataanalytics #datavisualization #visual #graph #chocolate #chocolaterating #ingredients #country #cocoa #graphs #dashboard#dashboards #tableau #barchart #bubblechart #metrics #linechart #filters</p><p><em>Originally published at </em><a href="https://analyticswithamruha.hashnode.dev/chocolate-ratings-analysis-using-tableau"><em>https://analyticswithamruha.hashnode.dev</em></a><em> on January 16, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=515683af3bc2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Perrin Sequence in Java]]></title>
            <link>https://medium.com/@amruha.ahmed/perrin-sequence-in-java-436d1f126464?source=rss-240a314d423------2</link>
            <guid isPermaLink="false">https://medium.com/p/436d1f126464</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[loop]]></category>
            <category><![CDATA[loops-in-java]]></category>
            <category><![CDATA[sequence]]></category>
            <dc:creator><![CDATA[Amruha Ahmed]]></dc:creator>
            <pubDate>Tue, 16 Jan 2024 02:26:47 GMT</pubDate>
            <atom:updated>2024-01-16T02:26:47.959Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5YGngds88HcAz4b6.png" /></figure><p>The Perrin Sequence, also known as the Skiponacci Sequence, is an integer sequence whose n’th term abides by the following recurrence relation :</p><blockquote><strong>P(N)=P(N-2)+P(N-3)</strong></blockquote><p>Where P(0)=3, P(1)=0 and P(2)=2 are the initial conditions.</p><h3><strong>Variables Required:</strong></h3><ul><li><strong>p0</strong>-first term of the sequence</li><li><strong>p1</strong>second term of the sequence</li><li><strong>p2</strong>-third term of the sequence</li><li><strong>pn</strong>- n’th term of the sequence</li><li><strong>n</strong>-number of terms to be displayed on the screen</li><li><strong>ctr</strong>-number of terms displayed currently</li></ul><h3><strong>Algorithm:</strong></h3><p>1.Start</p><p>2.Accept the number of terms till which the series needs to be printed and store in ‘n’</p><p>3.Initialize the values of ‘p0’,’p1&#39;,’p2&#39; to 3,0 and 2,respectively</p><p>4.Initialize the counter ‘ctr’ to 3, since the first three terms are going to be printed before entering the while loop</p><p>5.In order to generate the n’th term, calculate p0+p1 and store it in pn</p><p>6.While ‘ctr’ does not exceed ’n’ , the following steps need to be repeated:</p><p>(i) display the value of ‘pn’</p><p>(ii) Assign the value of ‘p1’ to ‘p0’</p><p>(iii) Assign the value of ‘p2’ to ‘p1’</p><p>(iv)Assign the value of ‘pn’ to ‘p2’</p><p>(v) Update the value of ‘pn’ as pn=p0+p1</p><p>7.Stop</p><h3><strong>Program:</strong></h3><pre>import java.util.*;<br>class perrinsequence<br>{<br>    void main()<br>    {<br>        Scanner ob=new Scanner(System.in);<br>        int p0=3;//first term of the sequence<br>        int p1=0;//second term of the sequence<br>        int p2=2;//third term of the sequence<br>        int pn;//n&#39;th term of the sequence<br>        int n;//number of terms to be displayed on the screen<br>        int ctr=3;//number of terms displayed currently<br>        System.out.println(&quot;Enter the number of terms:&quot;);<br>        n=ob.nextInt();<br>        System.out.println(&quot;The Perrin Sequence is ....\n&quot;);<br>        System.out.print(p0+&quot;\t&quot;+p1+&quot;\t&quot;+p2+&quot;\t&quot;);<br>        pn=p1+p0;//p(n)=p(n-2)+p(n-3)<br>        while(ctr&lt;n)<br>        {<br>            //displaying n&#39;th term<br>            System.out.print(pn+&quot;\t&quot;);<br>            //updating the terms of the sequence for the next iteration<br>            p0=p1;<br>            p1=p2;<br>            p2=pn;<br>            pn=p0+p1;<br>            // updating ctr value<br>            ctr++;<br>            <br>        }<br>    }<br>}  </pre><h3><strong>Dry Run:</strong></h3><p>Supposing the input of number limit that is ’n’ is provided as 6 then the values of p0,p1,p2 and pn will be as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KTXzj9wtpEbVbjI9.png" /></figure><p>The loop ceases when ctr becomes greater than or equal to n.</p><h3><strong>Output:</strong></h3><p>Enter the number of terms:6</p><p>The Perrin Sequence is ….</p><p>3 0 2 3 2 5</p><p><em>Originally published at </em><a href="https://codingjoy.netlify.app/perrinsequencejava"><em>https://codingjoy.netlify.app</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=436d1f126464" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cross Pattern in C Language]]></title>
            <link>https://medium.com/@amruha.ahmed/cross-pattern-in-c-language-822cf59bbcec?source=rss-240a314d423------2</link>
            <guid isPermaLink="false">https://medium.com/p/822cf59bbcec</guid>
            <category><![CDATA[nested-loop]]></category>
            <category><![CDATA[loop]]></category>
            <category><![CDATA[loops-in-c]]></category>
            <category><![CDATA[c-language]]></category>
            <category><![CDATA[patterns]]></category>
            <dc:creator><![CDATA[Amruha Ahmed]]></dc:creator>
            <pubDate>Sun, 14 Jan 2024 22:11:30 GMT</pubDate>
            <atom:updated>2024-01-14T22:11:30.681Z</atom:updated>
            <content:encoded><![CDATA[<p>This article will help you to create a cross pattern in C language which can be generated by using nested loops.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*GUIjlmcF4kLMu-FtSIxp6g.jpeg" /></figure><h3>Delving Deeper:</h3><p>1.The Cross Pattern “X” requires the usage of nested loops to print the “*” as shown in the picture.</p><p>2.It also needs two separate variables to keep a count of the spaces printed on the screen.</p><h3>Break-Up of the Upper Half of the Pattern:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*CMsbYRFPbClrV0VxgaXNsQ.jpeg" /></figure><p>1.Five rows should be printed in the upper half of the pattern.</p><p>2.The dashes are an indication of the spaces required . The number of dashes outside the pattern are stored in variable “m”. As observed, the number of dashes outside the pattern or “m” keeps increasing by 1 after each iteration i.e. after printing the first “*” in each row. The number of spaces as indicated by “m” are printed in the current row. Hence before starting the loop, “m” is initialized to 0.<br><strong>NOTE: This number “m” keeps varying according to the number of rows demanded by the question.</strong></p><p>3.Now, the first “*” is printed in the current row.</p><p>4.The number of dashes located in the middle of the pattern are stored in the variable “n”. As seen for the diagram, “n” is decreasing by 2 after printing the first “*” in each row. The number of spaces as indicated by “n” are printed in the current row. Hence, before starting the loop, “n” is initialized to 7.<br><strong>NOTE: This number “n” keeps varying according to the number of rows demanded by the question.</strong></p><p>5.In case the value of the outer loop counter is equal to 5,the rest of the loop gets bypassed, since, a single “*” should be present in the 5th row.</p><p>6.If the outer loop counter is not equal to 5, the next “*” needs to be printed in the current row on the screen .</p><h3>Break-Up of the Lower Half of the Pattern:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*Mte1Ew0BZqPZ6GE8o1-Wcg.jpeg" /></figure><p>1.The lower half of the pattern has 4 rows , with each row having two “*” separated by a space</p><p>2.The number of dashes outside the pattern are stored in variable “m”. As observed, the number of dashes outside the pattern or “m” keeps decreasing by 1 after each iteration i.e after printing the first “*” in each row. The number of spaces as indicated by “m” are printed in the current row. Hence before starting the loop, ”m” is initialized to 3.<br><strong>NOTE: This number “m” keeps varying according to the number of rows demanded by the question.</strong></p><p>3.Now, the first “*” is printed in the current row.</p><p>4.The number of dashes located in the middle of the pattern are stored in the variable “n”.As seen for the diagram, “n” is increasing by 2 after printing the first “*” in each row. The number of spaces as indicated by “n” are printed in the current row. Hence, before starting the loop, “n” is initialized to 1.<br><strong>NOTE: This number “n” keeps varying according to the number of rows demanded by the question</strong></p><p>5.The second “*” is printed on the screen.</p><h3>Program:</h3><pre>#include&lt;stdio.h&gt;<br>void main()<br>{<br>    int i,j,m,n;// i and j are loop counters <br>    // m and n are used as counters for spacing<br>    m=0;<br>    n=7;<br>    for(i=1;i&lt;=5;i++)<br>    {//to generate upper half of the pattern<br>       for(j=1;j&lt;=m;j++)<br>       {<br>           printf(&quot;   &quot;);<br>       }<br>       printf(&quot;* &quot;);<br>       for(j=1;j&lt;=n;j++)<br>       printf(&quot;   &quot;);<br>       m+=1;<br>       n-=2;<br>       if(i==5)<br>        continue;<br>       printf(&quot;* &quot;);<br>       printf(&quot;\n&quot;);<br>       <br>    }<br>    n=1;<br>    m=3;<br>    printf(&quot;\n&quot;);<br>    for(i=1;i&lt;=4;i++)<br>    { //to generate lower half of the pattern<br>        for(j=1;j&lt;=m;j++)<br>        printf(&quot;   &quot;);<br>        printf(&quot;* &quot;);<br>        for(j=1;j&lt;=n;j++)<br>        printf(&quot;   &quot;);<br>        printf(&quot;* &quot;);<br>        m-=1;<br>        n+=2;<br>        printf(&quot;\n&quot;);<br>        <br>    }<br>}</pre><h3>Output:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/269/1*tCLA1rTKh17SppzWbpF0Dg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=822cf59bbcec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Padovan Sequence in Java]]></title>
            <link>https://medium.com/@amruha.ahmed/padovan-sequence-in-java-f2e12850a8b8?source=rss-240a314d423------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2e12850a8b8</guid>
            <category><![CDATA[loop]]></category>
            <category><![CDATA[sequence]]></category>
            <category><![CDATA[loops-in-java]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Amruha Ahmed]]></dc:creator>
            <pubDate>Sun, 14 Jan 2024 21:36:24 GMT</pubDate>
            <atom:updated>2024-01-14T21:36:24.240Z</atom:updated>
            <content:encoded><![CDATA[<p>The Padovan Sequence is a special type of sequence in which the n’th term is determined by the recurrence relation:</p><blockquote><strong>P(n)=P(n-2)+P(n-3)</strong></blockquote><p>Where P(0),P(1) and P(2) are initialized to 1.<br> The following figure, in which the length of the current triangle’s side is determined by the sum of the lengths of the sides of those triangles that are touching it, can also be used to understand the Padovan Sequence (assuming that this spiral of equilateral triangle is drawn from inside out).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*f6wSf7nTQ0Pwti9e.png" /></figure><p>There can be two ways to generate the Padovan Sequence:</p><p>1.When the number of terms are provided by the user.</p><p>2.When the last term of the sequence is provided by the user, that is the number limit is provided.</p><p>In this blog post , I will be discussing how to generate the Padovan Sequence using the constraints mentioned above.</p><h3>Generating Padovan Sequence When Number of Terms are Given:</h3><p>Supposing the number of terms is given as 5, it means that the first 5 terms of the Padovan Sequence need to be printed on the screen.</p><h4><strong>Variables Required:</strong></h4><p>1.p0 : to store the 0&#39;th term of the sequence</p><p>2.p1 : to store the 1st term of the sequence</p><p>3.p2: to store the 2nd term of the sequence</p><p>4.pn: to store the n’th term of the sequence</p><p>5.limit: to store the number of terms of the sequence</p><p>6.ctr: to store the count of the terms already printed on the screen</p><h4><strong>Algorithm:</strong></h4><p>1.Accept the number of terms and store it in ‘limit’.</p><p>2.Initialize p0,p1,p2 to 1.</p><p>3.Initialize ctr to 3</p><p>4.To generate pn or the n’th term, sum up p0 and p1 and store the resultant in pn.</p><p>5.Display p0,p1 and p2.</p><p>6. While ctr does not exceed limit , the following steps need to be repeated:</p><ul><li>Display pn</li><li>Increment ctr</li><li>p0 is assigned value of p1</li><li>p1 is assigned value of p2</li><li>p2 is assigned value of pn</li><li>pn is assigned the value of p0+p1</li></ul><p>7.Stop</p><h4><strong>Program:</strong></h4><pre> import java.util.*;<br> class PadovanSequencefornoofterms {<br>   Scanner ob = new Scanner(System.in);<br>   void main() {<br>     int limit; //number of terms<br>     System.out.println(&quot;\n Enter the number of terms:&quot;);<br>     limit = ob.nextInt();<br>     int p0 = 1; //first term of the series<br>     int p1 = 1; //second term of series<br>     int p2 = 1; //third term of series<br>     int pn = p0 + p1; //current term of the series<br>     int ctr = 3; //count of digits printed<br>     System.out.print(p0 + &quot;\t&quot; + p1 + &quot;\t&quot; + p2 + &quot;\t&quot;);<br>     while (ctr &lt; limit) {<br>       System.out.print(pn + &quot;\t&quot;);<br>       ctr++;<br>       p0 = p1;<br>       p1 = p2;<br>       p2 = pn;<br>       pn = p0 + p1;<br>     }<br>   }<br> }</pre><p><strong>Dry Run:</strong></p><p>Supposing limit is given as 5.Then the values of p0,p1,p2,pn and ctr will be as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FR1eK5rAj7Jpx11O.png" /></figure><p>The while loop ceases when value of ctr becomes greater than or equal to limit.</p><p><strong>Output:</strong></p><p>Enter the number of terms: 5</p><p>1 1 1 2 2</p><h3><strong>Generating Padovan Sequence When Last Term of the Sequence is Given:</strong></h3><p>Supposing the number limit or last term is given as 5, it means that all the terms in Padovan Sequence that are less than or equal to 5 will be printed on the screen.</p><p><strong>Variables Required:</strong></p><p>1.n: to store the limit till which the sequence needs to be printed</p><p>2.p0 : to store the 0&#39;th term of the sequence</p><p>3.p1 : to store the 1st term of the sequence</p><p>4.p2: to store the 2nd term of the sequence</p><p>5.pn: to store the n’th term of the sequence</p><p><strong>Algorithm:</strong></p><p>1.Accept the limit till which the series needs to be printed and store it in ‘n’</p><p>2.Initialize p0,p1,p2 to 1</p><p>3.To generate pn or the n’th term, sum up p0 and p1 and store the resultant in pn.</p><p>4.Display p0,p1 and p2.</p><p>5. While pn does not exceed n , the following steps need to be repeated:</p><ul><li>Display pn</li><li>p0 is assigned value of p1</li><li>p1 is assigned value of p2</li><li>p2 is assigned value of pn</li><li>pn is assigned the value of p0+p1</li></ul><p>6.Stop</p><p><strong>Program:</strong></p><pre>import java.util.*;<br>class PadovanSequencetillanumber {<br>  Scanner ob = new Scanner(System.in);<br>  void main() {<br>    int n; //number till which the series is printed<br>    System.out.println(&quot;Enter a number:&quot;);<br>    n = ob.nextInt();<br>    int p0 = 1; //first term of series<br>    int p1 = 1; //second term of series<br>    int p2 = 1; //third term of series<br>    int pn = p1 + p0; //current or n&#39;th term of series<br>    System.out.print(p0 + &quot;\t&quot; + p1 + &quot;\t&quot; + p2 + &quot;\t&quot;);<br>    while (pn &lt;= n) {<br>      System.out.print(pn + &quot;\t&quot;);<br>      p0 = p1;<br>      p1 = p2;<br>      p2 = pn;<br>      pn = p0 + p1;<br><br>    }<br><br>  }<br>}</pre><p><strong>Dry Run:</strong></p><p>Supposing the input of number limit that is ’n’ is provided as 5 then the values of p0,p1,p2 and pn will be as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3KdAWBqusgFMokm2.png" /></figure><p>The loop ceases when pn becomes greater than n.</p><p><strong>OUTPUT:</strong></p><p>Enter a number: 5</p><p>1 1 1 2 2 3 4 5</p><p><em>Originally published at </em><a href="https://codingjoy.netlify.app/padovansequenceinjava"><em>https://codingjoy.netlify.app</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2e12850a8b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Catalan Numbers in Java]]></title>
            <link>https://medium.com/@amruha.ahmed/catalan-numbers-in-java-eb735921f5b9?source=rss-240a314d423------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb735921f5b9</guid>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[numbers]]></category>
            <category><![CDATA[catalan-number]]></category>
            <dc:creator><![CDATA[Amruha Ahmed]]></dc:creator>
            <pubDate>Wed, 03 Jan 2024 11:01:27 GMT</pubDate>
            <atom:updated>2024-01-03T11:01:27.166Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KkuVbrrT5XlrTaRy.png" /></figure><p>Catalan Numbers are the sequence of numbers that are calculated using the formula:</p><blockquote><strong>(2n)!/(n+1)!n!</strong></blockquote><p>Where n=0,1,2,3….</p><p>Catalan Numbers prove to be extremely useful in calculating the number of binary search trees that can be made using ’n’ nodes.</p><h3><strong>Functions Required:</strong></h3><ul><li><strong>fact():</strong> a recursive function to return the factorial of the parameter passed</li><li><strong>main():</strong> invokes fact() at appropriate intervals to calculate the desired number of Catalan numbers</li></ul><h3><strong>Variables Required in the Fact Function:</strong></h3><p><strong>n :</strong> passed as a parameter</p><h3>Variables Required in the Main Function:</h3><ul><li><strong>ctr: </strong>stores the count of numbers to be generated</li><li><strong>term1: </strong>stores the value of (2n)!</li><li><strong>term2: </strong>stores the value of (n+1)!</li><li><strong>term3: </strong>stores the value of n!</li><li><strong>finalterm: </strong>gives final term=catalan number at i’th position</li></ul><h3><strong>Algorithm for Main Function:</strong></h3><p>1.Start</p><p>2.Accept the count of Catalan numbers to be generated and store in ctr</p><p>3. For i =0 till i is less than ctr, the steps from 4 to 8 need to be repeated otherwise go to step 9</p><p>4. Invoke fact() and pass 2*i as a parameter.Store the result in term1</p><p>5.Invoke fact() and pass i+1 as a parameter. Store the result in term2</p><p>6. Invoke fact() and pass i as a parameter. Store the result in term3</p><p>7. Calculate term1/(term2+term3) and store the resultant in finalterm</p><p>8. Display finalterm</p><p>9.Stop</p><h3>Program:</h3><pre>import java.util.*;<br>class catalannumber<br>{<br>Scanner ob=new Scanner(System.in);<br>int fact(int n)//recursive function to calculate factorial of &#39;n&#39;<br>{<br>    if(n==0)<br>    return 1;<br>    else<br>    return(n*fact(n-1));<br>}<br>void main()<br>{<br>    int ctr;//stores the count of numbers to be generated<br>    System.out.print(&quot;\n Enter the count of catalan numbers to be generated:&quot;);<br>    ctr=ob.nextInt();<br>    System.out.println(&quot;\n The first &quot;+ctr+&quot; Catalan Numbers are...\n&quot;);<br>    for(int i=0;i&lt;ctr;i++)<br>    {<br>        int term1=fact(2*i);//stores the value of(2n)!<br>        int term2=fact(i+1);//stores the value of (n+1)!<br>        int term3=fact(i);//stores the value of n!<br>        int finalterm=(int)term1/(term2*term3);//gives final term=catalan number at i&#39;th position<br>        System.out.print(finalterm+&quot;  &quot;);<br>    }<br>}<br>}</pre><h3>Dry Run:</h3><p>If ctr=5 then the following will be the values of i, term1, term2, term3 and finalterm:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wm5FCfmxoWHjyCN3.png" /></figure><h3><strong>Output:</strong></h3><p>Enter the count of catalan numbers to be generated: 5</p><p>The first 5 Catalan Numbers are…</p><p>1 1 2 5 14</p><p><em>Originally published at </em><a href="https://codingjoy.netlify.app/catalannumberjava"><em>https://codingjoy.netlify.app</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb735921f5b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>