<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: JAIKUMAR DEWANGAN</title>
    <description>The latest articles on DEV Community by JAIKUMAR DEWANGAN (@jaikumar007).</description>
    <link>https://dev.to/jaikumar007</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%2F1830229%2Fe140d29d-ba19-4dd7-a498-3b7883a28c94.jpg</url>
      <title>DEV Community: JAIKUMAR DEWANGAN</title>
      <link>https://dev.to/jaikumar007</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jaikumar007"/>
    <language>en</language>
    <item>
      <title>Stack</title>
      <dc:creator>JAIKUMAR DEWANGAN</dc:creator>
      <pubDate>Wed, 04 Dec 2024 06:15:51 +0000</pubDate>
      <link>https://dev.to/jaikumar007/stack-5d3e</link>
      <guid>https://dev.to/jaikumar007/stack-5d3e</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include&amp;lt;bits/stdc++.h&amp;gt;

using namespace std;

void addStrIntoStack( string str)
{ 
    int n = str.length(); 
    string rev = "";
    stack &amp;lt;char&amp;gt;st ; 

    for(int i=0; i&amp;lt;n; i++)
    {
       st.push(str[i]) ;
    }

  // reverse 
  while(!st.empty())
  {
     if(st.top() == 'a' ||st.top() == 'e' || st.top() == 'i'||st.top() == 'o' ||st.top() == 'u' )
      {
           char ch = st.top() - 32;
             rev = rev + ch;
      } 
  else{ rev = rev + " " + st.top();}

    st.pop(); 
  }

  cout&amp;lt;&amp;lt;"string hai "&amp;lt;&amp;lt;rev; 

}

int main(){

  string s = "abcde" ; 

   addStrIntoStack( s);






    return 0; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;bits/stdc++.h&amp;gt;

using namespace std;

stack&amp;lt;char&amp;gt; addStrIntoStack(string str)
{
    int n = str.length();
    string rev = "";
    stack&amp;lt;char&amp;gt; st;

    for (int i = 0; i &amp;lt; n; i++)
    {
        st.push(str[i]);
    }

    // reverse
    return st;
}

string reverseStack(stack&amp;lt;char&amp;gt; &amp;amp;st, string rev)
{
    if (st.empty())
    {
        return rev;
    }

 rev = rev + st.top();
    st.pop();

    return reverseStack(st, rev);
}

int main()
{

    string s = "abcde";

    stack&amp;lt;char&amp;gt; st = addStrIntoStack(s);

    string rev = "";

    rev = reverseStack(st, rev);

    cout &amp;lt;&amp;lt;"ye hai :"&amp;lt;&amp;lt; rev;

    return 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;bits/stdc++.h&amp;gt;
using namespace std;

string prefix_to_infix(string str){
    stack&amp;lt;string&amp;gt; st;

    for(int i=str.length()-1;i&amp;gt;=0;i--) {
        if((str[i]&amp;gt;='a'&amp;amp;&amp;amp;str[i]&amp;lt;='z')||(str[i]&amp;gt;='A'&amp;amp;&amp;amp;str[i]&amp;lt;='Z')){
            string s ="";
            s+=(str[i]); // string me nhi aa rha tha 
            st.push(s);
        }
        else{
            string a = st.top();
            st.pop();
            string b = st.top();
            st.pop();
            string c = '('+a+str[i]+b+')';
            st.push(c);
        }
    }
    return st.top();
}
int main(){

    string s ;
    cin&amp;gt;&amp;gt;s;
    string str = prefix_to_infix(s);
    cout&amp;lt;&amp;lt;str;
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>ERP Recursion Code</title>
      <dc:creator>JAIKUMAR DEWANGAN</dc:creator>
      <pubDate>Tue, 03 Dec 2024 04:53:54 +0000</pubDate>
      <link>https://dev.to/jaikumar007/erp-recursion-code-54ok</link>
      <guid>https://dev.to/jaikumar007/erp-recursion-code-54ok</guid>
      <description>&lt;p&gt;&lt;strong&gt;1. Given an array A[ ], we need to find the sum of its elements using Tail Recursion Method. We generally want to achieve tail recursion (a recursive function where recursive call is the last thing that function does) so that compilers can optimize the code. Basically, if recursive call is the last&lt;/strong&gt; statement, the compiler does not need to save the state of parent call. &lt;br&gt;
Example:&lt;br&gt;
Input1 : A[] = {1, 8, 9}&lt;br&gt;
Output1 : 18&lt;/p&gt;

&lt;p&gt;Input2 : A[] = {2, 55, 1, 7}&lt;br&gt;
Output2 : 65&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;code&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;

 int recursive_sum( int arr[] , int i , int n ,  int sum)
 {
   if(i==n)
   {
    return sum; 
   }
   sum = sum + arr[i];
   recursive_sum(arr , i+1 , n , sum); 
 }

int main()
{

   int arr[] = {1,2,3,4,5}; 
 int sum =0 ;
 int  i=0;
 int n = sizeof(arr) /sizeof(arr[0]); 

 int ans = recursive_sum(arr , i ,n,  sum); 

 cout&amp;lt;&amp;lt;"the sum is "&amp;lt;&amp;lt;ans; 

    return 0; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;=====================================================================&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2 . Many problems of recursion revolve around strings and its substrings. We have got one such problem for you. You are given a string S, you have to find the count of all contiguous substrings starting and ending with the same character.&lt;/strong&gt;&lt;br&gt;
Example&lt;br&gt;
Input1: prepby&lt;br&gt;
Output1: 7&lt;br&gt;
Explanation: In the string, all the substrings that start and end with the same character are p, r, e, p, b, y, prep.&lt;br&gt;
Input2: abcde&lt;br&gt;
Output: 5&lt;br&gt;
Explanation: In the string, all the substrings that start and end with the same character are a, b, c, d, e.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;

int recursive_sum_string(string s, int i, int count) {

    if (s[i] == '\0') {
        return count; 
    }


    if (s[i] != ' ') {
        count++;
    }


    return recursive_sum_string(s, i + 1, count);
}

int main() {
    string s = "jai kumar"; 
    int i = 0; 
    int count = 0; 

    int ans = recursive_sum_string(s, i, count);

    cout &amp;lt;&amp;lt; "Here is the number of characters (excluding spaces): " &amp;lt;&amp;lt; ans &amp;lt;&amp;lt; endl;

    return 0; 
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;=====================================================================&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Count Set-bits of number using Recursion
Given a number N. The task is to find the number of set bits in its binary representation using recursion.
Examples: 
Input1 : 21 
Output1 : 3 
Explanation: 21 represented as 10101 in binary representation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Input2 : 16 &lt;br&gt;
Output2 : 1 &lt;br&gt;
Explanation:16 represented as 10000 in binary representation&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include&amp;lt;iostream&amp;gt; 

using namespace std ; 

int  setBit ( int n , int count )
{

  if(n==0)
  return count;

 if(n%2==1)
  count++; 

 setBit(n/2 , count) ; 

}

int main(){
   int n = 0  ; 
   int cnt=0;
int ans =  setBit ( n , cnt ); 

cout&amp;lt;&amp;lt;" no. of set bits "&amp;lt;&amp;lt; ans ;

    return 0 ; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;==========================================================&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Write a code to count digit K in a number N using Recursion
Test Case:
Input: 122622  2
Output: 4
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include&amp;lt;iostream&amp;gt;
using namespace std;

int count_digit_k(int n, int target, int cnt) {
    if (n == 0) {
        return cnt;
    }
    if (n % 10 == target) {
        cnt++;  
    }


    return count_digit_k(n / 10, target, cnt);
}

int main() {
    int n = 221212112;  
    int t = 1;           
    int cnt = 0;       

    cnt = count_digit_k(n, t, cnt);


    cout &amp;lt;&amp;lt; "Count of target " &amp;lt;&amp;lt; t &amp;lt;&amp;lt; " is: " &amp;lt;&amp;lt; cnt &amp;lt;&amp;lt; endl;

    return 0; 
}

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

&lt;/div&gt;



&lt;p&gt;Write a code to find the GCD of two numbers using recursion.&lt;br&gt;
Test Data :&lt;br&gt;
Input: 10 50&lt;br&gt;
Output: 10&lt;/p&gt;

&lt;p&gt;The problem is to generate the power set of a given string in lexicographical order.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Power set P(S) of a set S is the set of all subsets of S. 
For example S={a,b,c} then P(s)={{},{a},{b},{c},{a,b},{a,c},{b,c},{a,b,c}}. Print without empty set.

Example
Input:cab
Output: 
a
ab
abc
ac
b
bc
c
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You have a list arr of all integers in the range [1, n] sorted in a strictly increasing order. Apply the following algorithm on arr:&lt;br&gt;
Starting from left to right, remove the first number and every other number afterward until you reach the end of the list.&lt;br&gt;
Repeat the previous step again, but this time from right to left, remove the rightmost number and every other number from the remaining numbers.&lt;br&gt;
Keep repeating the steps again, alternating left to right and right to left, until a single number remains.&lt;br&gt;
Given the integer n, return the last number that remains in arr.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
Input: n = 9&lt;br&gt;
Output: 6&lt;br&gt;
Explanation:&lt;br&gt;
arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]&lt;br&gt;
arr = [2, 4, 6, 8]&lt;br&gt;
arr = [2, 6]&lt;br&gt;
arr = [6]&lt;/p&gt;

&lt;p&gt;Write a recursive code for findingthe sum of all the numbers until N reaches 1 after performing the following two operations:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; If N is even, then N = N/2&lt;/li&gt;
&lt;li&gt; If N is odd, then N = 3*N+1
Input: N = 5
Output: 36
Explanation:
The sequence will be [5, 16, 8, 4, 2, 1]
5 is odd so N becomes 5*3 + 1 = 16 
sum becomes 5 + 16 = 21
16 is even so N becomes 16/2 = 8 
sum becomes  21 + 8 = 29
8 is even so N becomes 8/2 = 4 
sum becomes  29 + 4 = 33
4 is even so N becomes 4/2 = 2 
sum becomes  33 + 2 = 35
2 is even so N becomes 2/2 = 1 
sum becomes  35 + 1 = 36
N becomes 1 , so return sum = 36&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Write a code to get the largest element of an array using recursion.&lt;br&gt;
Test Case:&lt;br&gt;
Input: 5&lt;br&gt;
5 10 15 20 25&lt;br&gt;
Output: 25&lt;/p&gt;

&lt;p&gt;Shubh solved lots of problems of Binary Number and her friends know she loves binary numbers. Her friend asked a question about this topic. She gave two number N and I and she told her on the 1st row write a 0, and in the 2nd row use just previous row and replace each 0 with 01 and each 1 with 10 in the current row.Now She asked to print Ith index value in the Nth row.&lt;br&gt;
Note: Each row index start from 1.  &lt;/p&gt;

&lt;p&gt;Input Format&lt;br&gt;
The first line contains two integers N and I.&lt;/p&gt;

&lt;p&gt;Output Format&lt;br&gt;
Print Ith index value in the Nth row.&lt;br&gt;
Example:&lt;br&gt;
Input :  N = 5, I = 13&lt;br&gt;
Output : 0 &lt;/p&gt;

&lt;p&gt;Explanation :&lt;br&gt;
1st row     0&lt;br&gt;
2nd row     01&lt;br&gt;
3rd row     0110&lt;br&gt;
4th row     01101001&lt;br&gt;
5th row     0110100110010110&lt;br&gt;
Therefore, 0 is the 13th bit in the 5th row&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Do coding during Collage</title>
      <dc:creator>JAIKUMAR DEWANGAN</dc:creator>
      <pubDate>Tue, 12 Nov 2024 17:28:40 +0000</pubDate>
      <link>https://dev.to/jaikumar007/how-to-do-coding-during-collage-d93</link>
      <guid>https://dev.to/jaikumar007/how-to-do-coding-during-collage-d93</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Analyze the College Syllabus&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Identify Your curriculum  Subjects:&lt;/strong&gt;  Start by listing all the subjects in your curriculum. For example, if you're interested in learning Python, check if it's part of this semester or if it will come later.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Focus on Current Subjects:&lt;/strong&gt; If you have the subject[like python] now, dive in and start learning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Delay if It’s for Later:&lt;/strong&gt; If it's a subject for a future semester, wait until then. Starting too early could mean you'll have to relearn it later, leading to double effort.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>coding</category>
      <category>management</category>
      <category>timemanagement</category>
    </item>
  </channel>
</rss>
