<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>EmbLogic &#187; sorting</title>
	<atom:link href="https://www.emblogic.com/blog/tag/sorting/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.emblogic.com/blog</link>
	<description>Embedded System and ARM Training</description>
	<lastBuildDate>Tue, 03 Mar 2020 13:00:06 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.1</generator>
	<item>
		<title>Bubble sorting using function</title>
		<link>https://www.emblogic.com/blog/01/bubble-sorting-using-function/</link>
		<comments>https://www.emblogic.com/blog/01/bubble-sorting-using-function/#comments</comments>
		<pubDate>Sat, 23 Jan 2016 06:00:50 +0000</pubDate>
		<dc:creator><![CDATA[Ankur Garg]]></dc:creator>
				<category><![CDATA[Data Structures with C]]></category>
		<category><![CDATA[bubble sorting]]></category>
		<category><![CDATA[c programming]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[sorting]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=13184</guid>
		<description><![CDATA[#include&#60;stdio.h&#62; //Program for Bubble Sorting int * bubblesort(int*,int); int display(int *,int); int main() { int i,j,a[100],N,temp; printf(&#8220;Enter no.of elements you want to sort:\t&#8221;); scanf(&#8220;%d&#8221;,&#38;N);//Max. no. of elements printf(&#8220;Enter %d elements you want to sort:\n&#8221;,N); for(i=0;i&#60;N;i++) scanf(&#8220;%d&#8221;,(a+i)); printf(&#8220;\nBefore sorting:\t&#8221;); display(a,N); //Sorting &#8230; <a href="https://www.emblogic.com/blog/01/bubble-sorting-using-function/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>#include&lt;stdio.h&gt;<br />
//Program for Bubble Sorting<br />
int * bubblesort(int*,int);<br />
int display(int *,int);<br />
int main()<br />
{<br />
int i,j,a[100],N,temp;</p>
<p>printf(&#8220;Enter no.of elements you want to sort:\t&#8221;);<br />
scanf(&#8220;%d&#8221;,&amp;N);//Max. no. of elements<br />
printf(&#8220;Enter %d elements you want to sort:\n&#8221;,N);<br />
for(i=0;i&lt;N;i++)<br />
scanf(&#8220;%d&#8221;,(a+i));<br />
printf(&#8220;\nBefore sorting:\t&#8221;);<br />
display(a,N);<br />
//Sorting Starts<br />
bubblesort(a,N);<br />
//Sorting Ends<br />
printf(&#8220;\nAfter sorting:\t&#8221;);<br />
display(a,N);<br />
}</p>
<p>int * bubblesort(int *a,int N)<br />
{<br />
int i,j,temp;<br />
for(i=0;i&lt;N-1;i++)<br />
for(j=0;j&lt;N-i-1;j++)<br />
if(a[j]&gt;a[j+1])<br />
{<br />
temp = a[j];<br />
a[j]=a[j+1];<br />
a[j+1]=temp;<br />
}<br />
return a;</p>
<p>}<br />
int display(int* a,int N)<br />
{<br />
int i;<br />
for(i=0;i&lt;N;i++)<br />
printf(&#8220;%d\t&#8221;,*(a+i));</p>
<p>return 0;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/01/bubble-sorting-using-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Selection Sorting in C</title>
		<link>https://www.emblogic.com/blog/01/selection-sorting-in-c/</link>
		<comments>https://www.emblogic.com/blog/01/selection-sorting-in-c/#comments</comments>
		<pubDate>Sun, 10 Jan 2016 10:03:19 +0000</pubDate>
		<dc:creator><![CDATA[Ankur Garg]]></dc:creator>
				<category><![CDATA[Data Structures with C]]></category>
		<category><![CDATA[c programming]]></category>
		<category><![CDATA[data structures]]></category>
		<category><![CDATA[data structures using c]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[selection sorting]]></category>
		<category><![CDATA[sorting]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=13144</guid>
		<description><![CDATA[#include&#60;stdio.h&#62; //Program for Selection Sorting int main() { int i,j,a[100],N,temp; printf(&#8220;Enter no.of elements you want to sort:\t&#8221;); scanf(&#8220;%d&#8221;,&#38;N);//max no. of elements printf(&#8220;Enter %d elements you want to sort:\n&#8221;,N); for(i=0;i&#60;N;i++) scanf(&#8220;%d&#8221;,(a+i)); printf(&#8220;\nBefore sorting:\t&#8221;); for(i=0;i&#60;N;i++) printf(&#8220;%d\t&#8221;,*(a+i)); //Sorting Starts for(i=0;i&#60;N-1;i++) for(j=i+1;j&#60;N;j++) if(a[i]&#62;a[j]) { &#8230; <a href="https://www.emblogic.com/blog/01/selection-sorting-in-c/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>#include&lt;stdio.h&gt;<br />
//Program for Selection Sorting<br />
int main()<br />
{<br />
int i,j,a[100],N,temp;</p>
<p>printf(&#8220;Enter no.of elements you want to sort:\t&#8221;);<br />
scanf(&#8220;%d&#8221;,&amp;N);//max no. of elements<br />
printf(&#8220;Enter %d elements you want to sort:\n&#8221;,N);<br />
for(i=0;i&lt;N;i++)<br />
scanf(&#8220;%d&#8221;,(a+i));<br />
printf(&#8220;\nBefore sorting:\t&#8221;);<br />
for(i=0;i&lt;N;i++)<br />
printf(&#8220;%d\t&#8221;,*(a+i));<br />
//Sorting Starts<br />
for(i=0;i&lt;N-1;i++)<br />
for(j=i+1;j&lt;N;j++)<br />
if(a[i]&gt;a[j])<br />
{<br />
temp = a[j];<br />
a[j]=a[i];<br />
a[i]=temp;<br />
}<br />
//Sorting Ends<br />
printf(&#8220;\nAfter sorting:\t&#8221;);<br />
for(i=0;i&lt;N;i++)<br />
printf(&#8220;%d\t&#8221;,*(a+i));<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/01/selection-sorting-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bubble Sorting in C</title>
		<link>https://www.emblogic.com/blog/01/bubble-sorting-in-c/</link>
		<comments>https://www.emblogic.com/blog/01/bubble-sorting-in-c/#comments</comments>
		<pubDate>Sun, 10 Jan 2016 09:58:16 +0000</pubDate>
		<dc:creator><![CDATA[Ankur Garg]]></dc:creator>
				<category><![CDATA[Data Structures with C]]></category>
		<category><![CDATA[bubble sorting]]></category>
		<category><![CDATA[c programming]]></category>
		<category><![CDATA[data structures using c]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[sorting]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=13142</guid>
		<description><![CDATA[#include&#60;stdio.h&#62; //Program for Bubble Sorting int main() { int i,j,a[100],N,temp; printf(&#8220;Enter no.of elements you want to sort:\t&#8221;); scanf(&#8220;%d&#8221;,&#38;N);//Max. no. of elements printf(&#8220;Enter %d elements you want to sort:\n&#8221;,N); for(i=0;i&#60;N;i++) scanf(&#8220;%d&#8221;,(a+i)); printf(&#8220;\nBefore sorting:\t&#8221;); for(i=0;i&#60;N;i++) printf(&#8220;%d\t&#8221;,*(a+i)); //Sorting Starts for(i=0;i&#60;N-1;i++) for(j=0;j&#60;N-i-1;j++) if(a[j]&#62;a[j+1]) { &#8230; <a href="https://www.emblogic.com/blog/01/bubble-sorting-in-c/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>#include&lt;stdio.h&gt;<br />
//Program for Bubble Sorting<br />
int main()<br />
{<br />
int i,j,a[100],N,temp;</p>
<p>printf(&#8220;Enter no.of elements you want to sort:\t&#8221;);<br />
scanf(&#8220;%d&#8221;,&amp;N);//Max. no. of elements<br />
printf(&#8220;Enter %d elements you want to sort:\n&#8221;,N);<br />
for(i=0;i&lt;N;i++)<br />
scanf(&#8220;%d&#8221;,(a+i));<br />
printf(&#8220;\nBefore sorting:\t&#8221;);<br />
for(i=0;i&lt;N;i++)<br />
printf(&#8220;%d\t&#8221;,*(a+i));<br />
//Sorting Starts<br />
for(i=0;i&lt;N-1;i++)<br />
for(j=0;j&lt;N-i-1;j++)<br />
if(a[j]&gt;a[j+1])<br />
{<br />
temp = a[j];<br />
a[j]=a[j+1];<br />
a[j+1]=temp;<br />
}<br />
//Sorting Ends<br />
printf(&#8220;\nAfter sorting:\t&#8221;);<br />
for(i=0;i&lt;N;i++)<br />
printf(&#8220;%d\t&#8221;,*(a+i));<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/01/bubble-sorting-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Insertion Sorting</title>
		<link>https://www.emblogic.com/blog/01/insertion-sorting-2/</link>
		<comments>https://www.emblogic.com/blog/01/insertion-sorting-2/#comments</comments>
		<pubDate>Sun, 10 Jan 2016 09:55:11 +0000</pubDate>
		<dc:creator><![CDATA[Ankur Garg]]></dc:creator>
				<category><![CDATA[Data Structures with C]]></category>
		<category><![CDATA[c programming]]></category>
		<category><![CDATA[data structures using c]]></category>
		<category><![CDATA[insertion sorting]]></category>
		<category><![CDATA[sorting]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=13140</guid>
		<description><![CDATA[#include&#60;stdio.h&#62; //Program for Insertion Sorting int main() { int i,j,k,N,a[100],temp; printf(&#8220;Enter no. of elements you want to sort :\t&#8221;); scanf(&#8220;%d&#8221;,&#38;N);//Max. no. of elements printf(&#8220;Enter %d elements you want to sort :\t&#8221;,N); for(i=0;i&#60;N;i++) scanf(&#8220;%d&#8221;,(a+i)); printf(&#8220;\nBefore Sorting:\t&#8221;); for(i=0;i&#60;N;i++) printf(&#8220;%d\t&#8221;,*(a+i)); //Sorting Process Start &#8230; <a href="https://www.emblogic.com/blog/01/insertion-sorting-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>#include&lt;stdio.h&gt;<br />
//Program for Insertion Sorting<br />
int main()<br />
{<br />
int i,j,k,N,a[100],temp;<br />
printf(&#8220;Enter no. of elements you want to sort :\t&#8221;);<br />
scanf(&#8220;%d&#8221;,&amp;N);//Max. no. of elements<br />
printf(&#8220;Enter %d elements you want to sort :\t&#8221;,N);<br />
for(i=0;i&lt;N;i++)<br />
scanf(&#8220;%d&#8221;,(a+i));<br />
printf(&#8220;\nBefore Sorting:\t&#8221;);<br />
for(i=0;i&lt;N;i++)<br />
printf(&#8220;%d\t&#8221;,*(a+i));<br />
//Sorting Process Start<br />
for(i=1;i&lt;N;i++)<br />
for(j=0;j&lt;i;j++)<br />
if(a[i]&lt;a[j])<br />
{<br />
temp = a[i];<br />
for(k=i;k&gt;j;k&#8211;)<br />
{<br />
a[k]=a[k-1];<br />
}<br />
a[j]=temp;<br />
}</p>
<p>//Sorting Ends<br />
printf(&#8220;\nAfter Sorting:\t&#8221;);<br />
for(i=0;i&lt;N;i++)<br />
printf(&#8220;%d\t&#8221;,*(a+i));<br />
return 0;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/01/insertion-sorting-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Sort using recursion</title>
		<link>https://www.emblogic.com/blog/07/quick-sort-using-recursion-2/</link>
		<comments>https://www.emblogic.com/blog/07/quick-sort-using-recursion-2/#comments</comments>
		<pubDate>Fri, 17 Jul 2015 05:27:27 +0000</pubDate>
		<dc:creator><![CDATA[Ankur Garg]]></dc:creator>
				<category><![CDATA[Data Structures with C]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Functions]]></category>
		<category><![CDATA[quick sort]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[sorting]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=12906</guid>
		<description><![CDATA[//Quick sorting using Recursion #include&#60;stdio.h&#62; #include&#60;stdlib.h&#62; //Prototypes of functions used int * input(int *,int); int * sort(int *,int); void display(int*,int); int main() { int *a,n; printf(&#8220;Enter number of numbers you want to sort?\n&#8221;); scanf(&#8220;%d&#8221;,&#38;n); a = input(a,n); a = sort(a,n);//call &#8230; <a href="https://www.emblogic.com/blog/07/quick-sort-using-recursion-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>//Quick sorting using Recursion<br />
#include&lt;stdio.h&gt;<br />
#include&lt;stdlib.h&gt;<br />
//Prototypes of functions used<br />
int * input(int *,int);<br />
int * sort(int *,int);<br />
void display(int*,int);<br />
int main()<br />
{<br />
int *a,n;<br />
printf(&#8220;Enter number of numbers you want to sort?\n&#8221;);<br />
scanf(&#8220;%d&#8221;,&amp;n);<br />
a = input(a,n);<br />
a = sort(a,n);//call to quick sort<br />
display(a,n);<br />
return 0;<br />
}<br />
//Function to input an array<br />
int * input(int *a,int n)<br />
{<br />
int i;<br />
printf(&#8220;Enter %d elements\n&#8221;,n);<br />
a = (int *)malloc(sizeof(int)*n);<br />
for(i=0;i&lt;n;i++)<br />
scanf(&#8220;%d&#8221;,&amp;a[i]);<br />
return a;<br />
}<br />
//Function to Quick Sort<br />
int * sort(int *data,int n)<br />
{<br />
int too_small_index,too_big_index,pivot,temp;<br />
pivot = 0;//Index of pivot element<br />
too_big_index = pivot + 1;<br />
too_small_index = n &#8211; 1;<br />
//Terminating condition for recursive call<br />
if(too_big_index&gt;too_small_index)<br />
return data;<br />
do<br />
{<br />
//Step 1<br />
while(*(data + too_big_index)&lt;=*(data + pivot))<br />
++too_big_index;<br />
//Step 2<br />
while(*(data + too_small_index)&gt;*(data + pivot))<br />
&#8211;too_small_index;<br />
//Step 3<br />
if(too_big_index&lt;too_small_index)<br />
{<br />
temp = *(data + too_big_index);<br />
*(data + too_big_index) = *(data + too_small_index);<br />
*(data+too_small_index) = temp;<br />
}<br />
}while(too_small_index&gt;too_big_index);//Step 4<br />
//Step 5<br />
temp = *(data + too_small_index);<br />
*(data + too_small_index) = *(data+pivot);<br />
*(data+pivot) = temp;<br />
//Sorting left side of array<br />
if(too_small_index!=too_big_index)<br />
data = sort(data,too_small_index);<br />
//sorting right side of array<br />
sort((data+too_small_index+1),n-too_small_index-1);<br />
return data;<br />
}<br />
//Function to display the array<br />
void display(int*a,int n )<br />
{<br />
int i;<br />
printf(&#8220;\nSorted list\n&#8221;);<br />
for(i=0;i&lt;n;i++)<br />
printf(&#8220;%d\t&#8221;,*(a+i));<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/07/quick-sort-using-recursion-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>linklist implementation using functions.</title>
		<link>https://www.emblogic.com/blog/02/linklist-implementation-using-functions/</link>
		<comments>https://www.emblogic.com/blog/02/linklist-implementation-using-functions/#comments</comments>
		<pubDate>Fri, 28 Feb 2014 14:33:37 +0000</pubDate>
		<dc:creator><![CDATA[saurabh2015ece]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[deletion (from begining node i.e 2nd node]]></category>
		<category><![CDATA[from the end node) & insertion (from begining node]]></category>
		<category><![CDATA[nth node]]></category>
		<category><![CDATA[nth node& at the end node) is done..and then displayed using display funct.]]></category>
		<category><![CDATA[sorting]]></category>

		<guid isPermaLink="false">http://www.emblogic.com/blog/?p=8458</guid>
		<description><![CDATA[RCS file: lll.c,v Working file: lll.c head: 1.8 branch: locks: strict saurabh: 1.8 access list: symbolic names: keyword substitution: kv total revisions: 8; selected revisions: 8 description: created a linklist program where diff aspects are being done. first created new &#8230; <a href="https://www.emblogic.com/blog/02/linklist-implementation-using-functions/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>RCS file: lll.c,v<br />
Working file: lll.c<br />
head: 1.8<br />
branch:<br />
locks: strict<br />
saurabh: 1.8<br />
access list:<br />
symbolic names:<br />
keyword substitution: kv<br />
total revisions: 8; selected revisions: 8<br />
description:<br />
created a linklist program where diff aspects are being done.<br />
first created new linklist<br />
second add a new node to the linklist which is already been created.<br />
so far a new node in inserted from the begining<br />
and from the end .</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.8 locked by: saurabh;<br />
date: 2014/02/28 14:16:42; author: saurabh; state: Exp; lines: +3 -4<br />
sorting function working properly<br />
insertion at nth node is working well.<br />
while deletion at the nth node is too working well<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.7<br />
date: 2014/02/28 13:49:08; author: saurabh; state: Exp; lines: +1 -1<br />
*** empty log message ***<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.6<br />
date: 2014/02/28 13:46:44; author: saurabh; state: Exp; lines: +1 -1<br />
problem in function insert at nth solved .<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.5<br />
date: 2014/02/28 13:42:50; author: saurabh; state: Exp; lines: +33 -15<br />
function called sort_ has been implemented in program .<br />
but there are some problem in function &#8220;insert_nth&#8221;.<br />
will solve later on<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.4<br />
date: 2014/02/27 20:03:10; author: saurabh; state: Exp; lines: +26 -2<br />
sorting not working <img src="https://www.emblogic.com/blog/wp-includes/images/smilies/icon_sad.gif" alt=":(" class="wp-smiley" /><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.3<br />
date: 2014/02/27 19:10:54; author: saurabh; state: Exp; lines: +19 -3<br />
implemented function called deletition from end .<br />
 <img src="https://www.emblogic.com/blog/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.2<br />
date: 2014/02/27 18:17:33; author: saurabh; state: Exp; lines: +159 -30<br />
created function called insertion at the end<br />
created function insertion at the nth node<br />
created function deletion<br />
implemented all above function the are working well<br />
implemented deletion from begining node using function<br />
implemented deletion from the nth node successflly<br />
prior to all such functions ,defined display function too .<br />
 <img src="https://www.emblogic.com/blog/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
revision 1.1<br />
date: 2014/02/24 21:09:57; author: saurabh; state: Exp;<br />
Initial revision<br />
=============================================================================</p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/02/linklist-implementation-using-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
