<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: Insertion sort in C program	</title>
	<atom:link href="https://studentprojects.in/software-development/c-tutorials/c/sorting/program-to-sort-the-numbers-using-insertion-sort/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in/software-development/c-tutorials/c/sorting/program-to-sort-the-numbers-using-insertion-sort/</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Sat, 10 Dec 2022 04:29:47 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>
		By: asadfdf		</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c/sorting/program-to-sort-the-numbers-using-insertion-sort/comment-page-2/#comment-141328</link>

		<dc:creator><![CDATA[asadfdf]]></dc:creator>
		<pubDate>Mon, 16 Nov 2015 07:48:14 +0000</pubDate>
		<guid isPermaLink="false">http://studentprojects.in/?p=351#comment-141328</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://studentprojects.in/software-development/c-tutorials/c/sorting/program-to-sort-the-numbers-using-insertion-sort/comment-page-2/#comment-9541&quot;&gt;potpot&lt;/a&gt;.

Source code of simple merge sort implementation using array in ascending order in c programming language

#include
#define MAX 50

void mergeSort(int arr[],int low,int mid,int high);
void partition(int arr[],int low,int high);

int main(){
   
    int merge[MAX],i,n;

    printf(&quot;Enter the total number of elements: &quot;);
    scanf(&quot;%d&quot;,&#038;n);

    printf(&quot;Enter the elements which to be sort: &quot;);
    for(i=0;i&#060;n;i++){
         scanf(&#034;%d&#034;,&#038;merge[i]);
    }

    partition(merge,0,n-1);

    printf(&#034;After merge sorting elements are: &#034;);
    for(i=0;i&#060;n;i++){
         printf(&#034;%d &#034;,merge[i]);
    }

   return 0;
}

void partition(int arr[],int low,int high){

    int mid;

    if(low&#060;high){
         mid=(low+high)/2;
         partition(arr,low,mid);
         partition(arr,mid+1,high);
         mergeSort(arr,low,mid,high);
    }
}

void mergeSort(int arr[],int low,int mid,int high){

    int i,m,k,l,temp[MAX];

    l=low;
    i=low;
    m=mid+1;

    while((l&#060;=mid)&#038;&#038;(m&#060;=high)){

         if(arr[l]mid){
         for(k=m;k&#060;=high;k++){
             temp[i]=arr[k];
             i++;
         }
    }
    else{
         for(k=l;k&#060;=mid;k++){
             temp[i]=arr[k];
             i++;
         }
    }
   
    for(k=low;k&#060;=high;k++){
         arr[k]=temp[k];
    }
}


Sample output:

Enter the total number of elements: 5
Enter the elements which to be sort: 2 5 0 9 1
After merge sorting elements are: 0 1 2 5 9]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://studentprojects.in/software-development/c-tutorials/c/sorting/program-to-sort-the-numbers-using-insertion-sort/comment-page-2/#comment-9541">potpot</a>.</p>
<p>Source code of simple merge sort implementation using array in ascending order in c programming language</p>
<p>#include<br />
#define MAX 50</p>
<p>void mergeSort(int arr[],int low,int mid,int high);<br />
void partition(int arr[],int low,int high);</p>
<p>int main(){</p>
<p>    int merge[MAX],i,n;</p>
<p>    printf(&#8220;Enter the total number of elements: &#8220;);<br />
    scanf(&#8220;%d&#8221;,&amp;n);</p>
<p>    printf(&#8220;Enter the elements which to be sort: &#8220;);<br />
    for(i=0;i&lt;n;i++){<br />
         scanf(&quot;%d&quot;,&amp;merge[i]);<br />
    }</p>
<p>    partition(merge,0,n-1);</p>
<p>    printf(&quot;After merge sorting elements are: &quot;);<br />
    for(i=0;i&lt;n;i++){<br />
         printf(&quot;%d &quot;,merge[i]);<br />
    }</p>
<p>   return 0;<br />
}</p>
<p>void partition(int arr[],int low,int high){</p>
<p>    int mid;</p>
<p>    if(low&lt;high){<br />
         mid=(low+high)/2;<br />
         partition(arr,low,mid);<br />
         partition(arr,mid+1,high);<br />
         mergeSort(arr,low,mid,high);<br />
    }<br />
}</p>
<p>void mergeSort(int arr[],int low,int mid,int high){</p>
<p>    int i,m,k,l,temp[MAX];</p>
<p>    l=low;<br />
    i=low;<br />
    m=mid+1;</p>
<p>    while((l&lt;=mid)&amp;&amp;(m&lt;=high)){</p>
<p>         if(arr[l]mid){<br />
         for(k=m;k&lt;=high;k++){<br />
             temp[i]=arr[k];<br />
             i++;<br />
         }<br />
    }<br />
    else{<br />
         for(k=l;k&lt;=mid;k++){<br />
             temp[i]=arr[k];<br />
             i++;<br />
         }<br />
    }</p>
<p>    for(k=low;k&lt;=high;k++){<br />
         arr[k]=temp[k];<br />
    }<br />
}</p>
<p>Sample output:</p>
<p>Enter the total number of elements: 5<br />
Enter the elements which to be sort: 2 5 0 9 1<br />
After merge sorting elements are: 0 1 2 5 9</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: MCO		</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c/sorting/program-to-sort-the-numbers-using-insertion-sort/comment-page-2/#comment-135391</link>

		<dc:creator><![CDATA[MCO]]></dc:creator>
		<pubDate>Tue, 06 Oct 2015 18:53:42 +0000</pubDate>
		<guid isPermaLink="false">http://studentprojects.in/?p=351#comment-135391</guid>

					<description><![CDATA[#include 
using namespace std;
int main()
{   int  k,A[6];
    for(int i=0;i&#062;A[i];
    }
    for(int i=1;i=0 &#038;&#038; A[j]&#062;A[i])
        {
            A[j+1]=A[j];
            j--;
        }
A[j+1]=value;
    }
    cout&#060;&#060;&#034;sorted list&#034;&#060;&#060;endl;
    for( k=0;k&#060;6;k++)
    {
        cout&#060;&#060;A[k]&#060;&#060;&#034;\t&#034;;
    }
    return 0;
}
/* wht give the wrong output?? i tryed to check it ...plz help*/]]></description>
			<content:encoded><![CDATA[<p>#include<br />
using namespace std;<br />
int main()<br />
{   int  k,A[6];<br />
    for(int i=0;i&gt;A[i];<br />
    }<br />
    for(int i=1;i=0 &amp;&amp; A[j]&gt;A[i])<br />
        {<br />
            A[j+1]=A[j];<br />
            j&#8211;;<br />
        }<br />
A[j+1]=value;<br />
    }<br />
    cout&lt;&lt;&quot;sorted list&quot;&lt;&lt;endl;<br />
    for( k=0;k&lt;6;k++)<br />
    {<br />
        cout&lt;&lt;A[k]&lt;&lt;&quot;\t&quot;;<br />
    }<br />
    return 0;<br />
}<br />
/* wht give the wrong output?? i tryed to check it &#8230;plz help*/</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Dhenge Sandip		</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c/sorting/program-to-sort-the-numbers-using-insertion-sort/comment-page-2/#comment-119820</link>

		<dc:creator><![CDATA[Dhenge Sandip]]></dc:creator>
		<pubDate>Wed, 22 Jul 2015 06:14:46 +0000</pubDate>
		<guid isPermaLink="false">http://studentprojects.in/?p=351#comment-119820</guid>

					<description><![CDATA[thanks]]></description>
			<content:encoded><![CDATA[<p>thanks</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Chandrakanth		</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c/sorting/program-to-sort-the-numbers-using-insertion-sort/comment-page-2/#comment-101314</link>

		<dc:creator><![CDATA[Chandrakanth]]></dc:creator>
		<pubDate>Mon, 04 May 2015 19:15:44 +0000</pubDate>
		<guid isPermaLink="false">http://studentprojects.in/?p=351#comment-101314</guid>

					<description><![CDATA[Well explained. I assume there is one error in the code during runtime. Changed below code.

while( j&#062;=0 &#038;&#038; Temp&#060;A[j] )
		{
			A[j+1] = A[j];
			j = j-1;
		}]]></description>
			<content:encoded><![CDATA[<p>Well explained. I assume there is one error in the code during runtime. Changed below code.</p>
<p>while( j&gt;=0 &amp;&amp; Temp&lt;A[j] )<br />
		{<br />
			A[j+1] = A[j];<br />
			j = j-1;<br />
		}</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: varsha		</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c/sorting/program-to-sort-the-numbers-using-insertion-sort/comment-page-2/#comment-58875</link>

		<dc:creator><![CDATA[varsha]]></dc:creator>
		<pubDate>Thu, 11 Dec 2014 18:35:19 +0000</pubDate>
		<guid isPermaLink="false">http://studentprojects.in/?p=351#comment-58875</guid>

					<description><![CDATA[m confused in insertion sort .....when comparison is done and 1st pass  completes then how elements compare with all the previous elements there is no loop ......pls explain.....]]></description>
			<content:encoded><![CDATA[<p>m confused in insertion sort &#8230;..when comparison is done and 1st pass  completes then how elements compare with all the previous elements there is no loop &#8230;&#8230;pls explain&#8230;..</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: ATCHUTA RAO		</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c/sorting/program-to-sort-the-numbers-using-insertion-sort/comment-page-2/#comment-10457</link>

		<dc:creator><![CDATA[ATCHUTA RAO]]></dc:creator>
		<pubDate>Fri, 28 Feb 2014 06:23:12 +0000</pubDate>
		<guid isPermaLink="false">http://studentprojects.in/?p=351#comment-10457</guid>

					<description><![CDATA[#include
#include
void main()
{
   int a[20],k,n,i=0,j=0,t=0;

   clrscr();
    printf(&quot;no of of elemts&quot;);
    scanf(&quot;%d&quot;,&#038;n);
    printf(&quot;enter %d values&quot;,n);
   for(i=0;i&#060;n;i++)
   scanf(&#034;%d&#034;,&#038;a[i]);


   for(i=1;i=1;j--)
   {

    printf(&quot;i=%d j=%d %d %d&quot;,i,j,a[j],a[j-1]);
     if(a[j]&#062;a[j-1])
      break;
   else
      {
  t=a[j];
  a[j]=a[j-1];
  a[j-1]=t;
}

}	   printf(&quot;\n&quot;);
     } printf(&quot;\n&quot;);


for(i=0;i&#060;n;i++)
printf(&#034;  %d &#034;,a[i]);
getch();
}


THE ABOVE CODE REPRESENTS WHICH SORTING TECHNIQUE????
 
DOES IT REPRESENT INSERTION SORT????]]></description>
			<content:encoded><![CDATA[<p>#include<br />
#include<br />
void main()<br />
{<br />
   int a[20],k,n,i=0,j=0,t=0;</p>
<p>   clrscr();<br />
    printf(&#8220;no of of elemts&#8221;);<br />
    scanf(&#8220;%d&#8221;,&amp;n);<br />
    printf(&#8220;enter %d values&#8221;,n);<br />
   for(i=0;i&lt;n;i++)<br />
   scanf(&quot;%d&quot;,&amp;a[i]);</p>
<p>   for(i=1;i=1;j&#8211;)<br />
   {</p>
<p>    printf(&#8220;i=%d j=%d %d %d&#8221;,i,j,a[j],a[j-1]);<br />
     if(a[j]&gt;a[j-1])<br />
      break;<br />
   else<br />
      {<br />
  t=a[j];<br />
  a[j]=a[j-1];<br />
  a[j-1]=t;<br />
}</p>
<p>}	   printf(&#8220;\n&#8221;);<br />
     } printf(&#8220;\n&#8221;);</p>
<p>for(i=0;i&lt;n;i++)<br />
printf(&quot;  %d &quot;,a[i]);<br />
getch();<br />
}</p>
<p>THE ABOVE CODE REPRESENTS WHICH SORTING TECHNIQUE????</p>
<p>DOES IT REPRESENT INSERTION SORT????</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: pls multy way tree sample program for ds insertion deletion plz............		</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c/sorting/program-to-sort-the-numbers-using-insertion-sort/comment-page-2/#comment-10446</link>

		<dc:creator><![CDATA[pls multy way tree sample program for ds insertion deletion plz............]]></dc:creator>
		<pubDate>Tue, 18 Feb 2014 17:50:27 +0000</pubDate>
		<guid isPermaLink="false">http://studentprojects.in/?p=351#comment-10446</guid>

					<description><![CDATA[multy way tree]]></description>
			<content:encoded><![CDATA[<p>multy way tree</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: keerthika		</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c/sorting/program-to-sort-the-numbers-using-insertion-sort/comment-page-2/#comment-10070</link>

		<dc:creator><![CDATA[keerthika]]></dc:creator>
		<pubDate>Wed, 04 Sep 2013 02:11:57 +0000</pubDate>
		<guid isPermaLink="false">http://studentprojects.in/?p=351#comment-10070</guid>

					<description><![CDATA[sir,i want to know what is use of gotoxy()?]]></description>
			<content:encoded><![CDATA[<p>sir,i want to know what is use of gotoxy()?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: merusha		</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c/sorting/program-to-sort-the-numbers-using-insertion-sort/comment-page-2/#comment-9951</link>

		<dc:creator><![CDATA[merusha]]></dc:creator>
		<pubDate>Tue, 30 Jul 2013 10:08:02 +0000</pubDate>
		<guid isPermaLink="false">http://studentprojects.in/?p=351#comment-9951</guid>

					<description><![CDATA[Rohon dar gude batha...tai boli dudu khao..]]></description>
			<content:encoded><![CDATA[<p>Rohon dar gude batha&#8230;tai boli dudu khao..</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: AOT		</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c/sorting/program-to-sort-the-numbers-using-insertion-sort/comment-page-2/#comment-9950</link>

		<dc:creator><![CDATA[AOT]]></dc:creator>
		<pubDate>Tue, 30 Jul 2013 10:05:09 +0000</pubDate>
		<guid isPermaLink="false">http://studentprojects.in/?p=351#comment-9950</guid>

					<description><![CDATA[For balchhal programs contact AOT guys....West bengal...chodao bara]]></description>
			<content:encoded><![CDATA[<p>For balchhal programs contact AOT guys&#8230;.West bengal&#8230;chodao bara</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
