<?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>array | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/array/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Mon, 31 Jan 2011 12:18:55 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>C++ program to implement circular queue using array</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-circular-queue-using-array/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-circular-queue-using-array/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Wed, 02 Feb 2011 12:16:03 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[circular queue]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1269</guid>

					<description><![CDATA[<p>#include class cqueue { private : int *arr ; int front, rear ; int MAX; public : cqueue( int maxsize = 10 ) ; void addq ( int item ) ; int delq( ) ; void display( ) ; } ; cqueue :: cqueue( int maxsize ) { MAX = maxsize ; arr = new</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-circular-queue-using-array/">C++ program to implement circular queue using array</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="cpp">
#include <iostream.h>
class cqueue
{
	private :
		int *arr ;
		int front, rear ;
		int MAX;
	public :
		cqueue( int maxsize = 10 ) ;
		void addq ( int item ) ;
		int delq( ) ;
		void display( ) ;
} ;
cqueue :: cqueue( int maxsize )
{
	MAX = maxsize ;
	arr = new int [ MAX ];
	front = rear = -1 ;
	for ( int i = 0 ; i < MAX ; i++ )
		arr[i] = 0 ;
}
void cqueue :: addq ( int item )
{
	if ( ( rear + 1 ) % MAX == front )
	{
		cout << "\nQueue is full" ;
		return ;
	}
	rear = ( rear + 1 ) % MAX;
	arr[rear] = item ;
	if ( front == -1 )
		front = 0 ;
}
int cqueue :: delq( )
{
	int data ;
	if ( front == -1 )
	{
		cout << "\nQueue is empty" ;
		return NULL ;
	}

	data = arr[front] ;
	arr[front] = 0 ;
	if ( front == rear )
	{
		front = -1 ;
		rear = -1 ;
	}
	else
		front = ( front + 1 ) % MAX;
	return data ;
}
void cqueue :: display( )
{
	cout << endl ;
	for ( int i = 0 ; i < MAX ; i++ )
		cout << arr[i] << "  " ;
	cout << endl ;
}
void main( )
{
	cqueue a ( 10 ) ;
	a.addq ( 14 ) ;
	a.addq ( 22 ) ;
	a.addq ( 13 ) ;
	a.addq ( -6 ) ;
	a.addq ( 25 ) ;
	cout << "\nElements in the circular queue: " ;
	a.display( ) ;
	int i = a.delq( ) ;
	cout << "Item deleted: " << i ;
	i = a.delq( ) ;
	cout << "\nItem deleted: " << i ;
	cout << "\nElements in the circular queue after deletion: " ;
	a.display( ) ;
	a.addq ( 21 ) ;
	a.addq ( 17 ) ;
	a.addq ( 18 ) ;
	a.addq ( 9 ) ;
	a.addq ( 20 ) ;
	cout << "Elements in the circular queue after addition: " ;
	a.display( ) ;
	a.addq ( 32 ) ;
	cout << "Elements in the circular queue after addition: " ;
	a.display( ) ;
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-circular-queue-using-array/">C++ program to implement circular queue using array</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-implement-circular-queue-using-array/feed/</wfw:commentRss>
			<slash:comments>11</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program to implement Heap sort Algorithm</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-heap-sort-algorithm/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-heap-sort-algorithm/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Tue, 01 Feb 2011 13:38:53 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<category><![CDATA[Source Codes]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[Heap sort]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1240</guid>

					<description><![CDATA[<p>#include const int MAX = 10 ; class array { private : int arr[MAX] ; int count ; public : array( ) ; void add ( int num ) ; void makeheap(int ) ; void heapsort( ) ; void display( ) ; } ; array :: array( ) { count = 0 ; for (</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-heap-sort-algorithm/">C++ program to implement Heap sort Algorithm</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="cpp">
#include <iostream.h>
const int MAX = 10 ;
class array
{
	private :
		int arr[MAX] ;
		int count ;
	public :
		array( ) ;
		void add ( int num ) ;
		void makeheap(int ) ;
		void heapsort( ) ;
		void display( ) ;
} ;
array :: array( )
{
	count = 0 ;
	for ( int i = 0 ; i < MAX ; i++ )
		arr[MAX] = 0 ;
}
void array :: add ( int num )
{
	if ( count < MAX )
	{
		arr[count] = num ;
		count++ ;
	}
	else
		cout << "\nArray is full" << endl ;
}
void array :: makeheap(int c)
{

	for ( int i = 1 ; i < c ; i++ )
	{
		int val = arr[i] ;
		int s = i ;
		int f = ( s - 1 ) / 2 ;
		while ( s > 0 && arr[f] < val )
		{
			arr[s] = arr[f] ;
			s = f ;
			f = ( s - 1 ) / 2 ;
		}
		arr[s] = val ;
	}
}
void array :: heapsort( )
{
	for ( int i = count - 1 ; i > 0 ; i-- )
	{
		int ivalue = arr[i] ;
		arr[i] = arr[0] ;
		arr[0]=ivalue;
		makeheap(i);

	}
}
void array :: display( )
{
	for ( int i = 0 ; i < count ; i++ )
		cout << arr[i] << "\t" ;
	cout << endl ;
}
void main( )
{
	array a ;

	a.add ( 11 ) ;
	a.add ( 2 ) ;
	a.add ( 9 ) ;
	a.add ( 13 ) ;
	a.add ( 57 ) ;
	a.add ( 25 ) ;
	a.add ( 17 ) ;
	a.add ( 1 ) ;
	a.add ( 90 ) ;
	a.add ( 3  ) ;
	a.makeheap(10) ;
	cout << "\nHeap Sort.\n" ;
	cout << "\nBefore Sorting:\n"  ;
	a.display( ) ;
	a.heapsort( ) ;
	cout << "\nAfter Sorting:\n" ;
	a.display( ) ;
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-heap-sort-algorithm/">C++ program to implement Heap sort Algorithm</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-heap-sort-algorithm/feed/</wfw:commentRss>
			<slash:comments>13</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program to implement Quick sort Algorithm using class</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-quick-sort-algorithm-using-class/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-quick-sort-algorithm-using-class/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Tue, 01 Feb 2011 13:35:44 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[Source Codes]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[Quick sort]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1238</guid>

					<description><![CDATA[<p>#include const int MAX = 10 ; class array { private : int arr[MAX] ; int count ; public : array( ) ; void add ( int item ) ; int getcount( ) ; static int split ( int *, int, int ) ; void quiksort ( int lower, int upper ) ; void display(</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-quick-sort-algorithm-using-class/">C++ program to implement Quick sort Algorithm using class</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="cpp">
#include <iostream.h>
const int MAX = 10 ;
class array
{
	private :

		int arr[MAX] ;
		int count ;
	public :

		array( ) ;
		void add ( int item ) ;
		int getcount( ) ;
		static int split ( int *, int, int ) ;
		void quiksort ( int lower, int upper ) ;
		void display( ) ;
} ;
array :: array( )
{
	count = 0 ;
	for ( int i = 0 ; i < MAX ; i++ )
		arr[i] = 0 ;
}
void array :: add ( int item )
{
	if ( count < MAX )
	{
		arr[count] = item ;
		count++ ;
	}
	else
		cout << "\nArray is full" << endl ;
}
int array :: getcount( )
{
	return count ;
}
void array :: quiksort ( int lower, int upper )
{
	if ( upper > lower )
	{
		int i = split ( arr, lower, upper ) ;
		quiksort ( lower, i - 1 ) ;
		quiksort ( i + 1, upper ) ;
	}
}
int array :: split ( int *a, int lower, int upper )
{
	int i, p, q, t ;

	p = lower + 1 ;
	q = upper ;
	i = a[lower] ;
	while ( q >= p )
	{
		while ( a[p] < i )
			p++ ;
		while ( a[q] > i )
			q-- ;
		if ( q > p )
		{
			t = a[p] ;
			a[p] = a[q] ;
			a[q] = t ;
		}
	}
	t = a[lower] ;
	a[lower] = a[q] ;
	a[q] = t ;
	return q ;
}
void array :: display( )
{
	for ( int i = 0 ; i < count ; i++ )
		cout << arr[i] << "  " ;
	cout << endl ;
}
void main( )
{
	array a ;
	a.add ( 11 ) ;
	a.add ( 2 ) ;
	a.add ( 9 ) ;
	a.add ( 13 ) ;
	a.add ( 57 ) ;
	a.add ( 25 ) ;
	a.add ( 17 ) ;
	a.add ( 1 ) ;
	a.add ( 90 ) ;
	a.add ( 3 ) ;
	cout << "\nQuik sort.\n" ;
	cout << "\nArray before sorting:" << endl ;
	a.display( ) ;
	int c = a.getcount( ) ;
	a.quiksort ( 0, c - 1 ) ;
	cout << "\nArray after quick sorting:" << endl ;
	a.display( ) ;
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-quick-sort-algorithm-using-class/">C++ program to implement Quick sort Algorithm using class</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-quick-sort-algorithm-using-class/feed/</wfw:commentRss>
			<slash:comments>10</slash:comments>
		
		
			</item>
		<item>
		<title>C++ rogram to implement merge sort</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-rogram-to-implement-merge-sort/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-rogram-to-implement-merge-sort/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Tue, 01 Feb 2011 13:34:06 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<category><![CDATA[Source Codes]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[Merge sort]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1236</guid>

					<description><![CDATA[<p>#include const int MAX = 5 ; class array { private : int *a ; int size ; int count ; public : array( ) ; array ( int sz ) ; void add ( int num ) ; void display( ) ; void merge_sort(int low,int high); void merge(int low,int mid,int high); ~array( ) ;</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-rogram-to-implement-merge-sort/">C++ rogram to implement merge sort</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="cpp">
#include <iostream.h>
const int MAX = 5 ;
class array
{
	private :
		int *a ;
		int size ;
		int count ;
	public :
		array( ) ;
		array ( int sz ) ;
		void add ( int num ) ;
		void display( ) ;
		void merge_sort(int low,int high);
		void merge(int low,int mid,int high);
		~array( ) ;
} ;
array :: array( )
{
	count = size = 0 ;
	a = NULL ;
}
array :: array( int sz )
{
	count = 0 ;
	size = sz ;
	a = new int[sz] ;
}
void array :: add ( int num )
{
	if ( count < size )
	{
		a[count] = num ;
		count++ ;
	}
	else
		cout << "\nArray is full" << endl ;
}
void array :: display( )
{
	for ( int i = 0 ; i < count ; i++ )
		cout << a[i] << "\t" ;
	cout << endl ;
}
void array :: merge_sort(int low,int high)
{

	int mid;
	if(low<high)
	{
		mid=(low+high)/2;
		merge_sort(low,mid);
		merge_sort(mid+1,high);
		merge(low,mid,high);
	}
}
void array :: merge(int low,int mid,int high)
{
	int h,i,j,b[50],k;
	h=low;
	i=low;
	j=mid+1;

	while((h<=mid)&#038;&#038;(j<=high))
	{
		if(a[h]<=a[j])
		{
			b[i]=a[h];
			h++;
		}
		else
		{
			b[i]=a[j];
			j++;
		}
		i++;
	}
	if(h>mid)
	{
		for(k=j;k<=high;k++)
		{
			b[i]=a[k];
			i++;
		}
	}
	else
	{
		for(k=h;k<=mid;k++)
		{
			b[i]=a[k];
			i++;
		}
	}
	for(k=low;k<=high;k++) a[k]=b[k];
}
array :: ~array( )
{
	delete a ;
}

void main( )
{
	array a ( MAX ) ;

	a.add ( 11 ) ;
	a.add ( 2 ) ;
	a.add ( 9 ) ;
	a.add ( 13 ) ;
	a.add ( 57 ) ;

	cout << "\nMerge sort.\n" ;

	a.merge_sort (0,4) ;

	cout << "\nArray after sorting: " << endl ;
	a.display( ) ;
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-rogram-to-implement-merge-sort/">C++ rogram to implement merge sort</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-rogram-to-implement-merge-sort/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program to implement Insertion sort using class</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-insertion-sort-using-class/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-insertion-sort-using-class/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Tue, 01 Feb 2011 13:27:51 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<category><![CDATA[Source Codes]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[Insertion sort]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1230</guid>

					<description><![CDATA[<p>#include const int MAX = 10 ; class array { private : int arr[MAX] ; int count ; public : array( ) ; void add ( int item ) ; void sort( ) ; void display( ) ; } ; array :: array( ) { count = 0 ; for ( int i = 0</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-insertion-sort-using-class/">C++ program to implement Insertion sort using class</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="cpp">
#include <iostream.h>
const int MAX = 10 ;
class array
{
	private :
		int arr[MAX] ;
		int count ;
	public :
		array( ) ;
		void add ( int item ) ;
		void sort( ) ;
		void display( ) ;
} ;
array :: array( )
{
	count = 0 ;
	for ( int i = 0 ; i < MAX ; i++ )
		arr[i] = 0 ;
}
void array :: add ( int item )
{
	if ( count < MAX )
	{
		arr[count] = item ;
		count++ ;
	}
	else
		cout << "\nArray is full" << endl ;
}
void array :: sort( )
{
	int temp ;
	for ( int i = 1 ; i <= count - 1 ; i++ )
	{
		for ( int j = 0 ; j < i ; j++ )
		{
			if ( arr[j] > arr[i] )
			{
				temp = arr[j] ;
				arr[j] = arr[i] ;
				for ( int k = i ; k > j ; k-- )
					arr[k] = arr[k - 1] ;
				arr[k + 1] = temp ;
			}
		}
	}
}

void array :: display( )
{
	for ( int i = 0 ; i < count ; i++ )
		cout << arr[i] << "\t" ;
	cout << endl ;
}
void main( )
{
	array a ;
	a.add ( 25 ) ;
	a.add ( 17 ) ;
	a.add ( 31 ) ;
	a.add ( 13 ) ;
	a.add ( 2 ) ;
	cout << "\nInsertion sort.\n" ;
	cout << "\nArray before sorting:" << endl ;
	a.display( ) ;
	a.sort( ) ;
	cout << "\nArray after insertion sorting:" << endl ;
	a.display( ) ;
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-insertion-sort-using-class/">C++ program to implement Insertion sort using class</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-insertion-sort-using-class/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program to implement Selection sort using class</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-selection-sort-using-class/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-selection-sort-using-class/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Tue, 01 Feb 2011 12:33:33 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<category><![CDATA[Selection sort]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[array]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1227</guid>

					<description><![CDATA[<p>#include const int MAX = 10 ; class array { private : int arr[MAX] ; int count ; public : array( ) ; void add ( int item ) ; void sort( ) ; void display( ) ; } ; array :: array( ) { count = 0 ; for ( int i = 0</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-selection-sort-using-class/">C++ program to implement Selection sort using class</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="cpp">
#include <iostream.h>
const int MAX = 10 ;
class array
{
	private :
		int arr[MAX] ;
		int count ;
	public :
		array( ) ;
		void add ( int item ) ;
		void sort( ) ;
		void display( ) ;
} ;
array :: array( )
{
	count = 0 ;
	for ( int i = 0 ; i < MAX ; i++ )
		arr[i] = 0 ;
}
void array :: add ( int item )
{
	if ( count < MAX )
	{
		arr[count] = item ;
		count++ ;
	}
	else
		cout << "\nArray is full" << endl ;
}
void array :: sort( )
{
	int temp ;
	for ( int i = 0 ; i <= count - 2 ; i++ )
	{
		for ( int j = i + 1 ; j <= count - 1 ; j++ )
		{
			if ( arr[i] > arr[j] )
			{
				temp = arr[i] ;
				arr[i] = arr[j] ;
				arr[j] = temp ;
			}
		}
	}
}
void array :: display( )
{
	for ( int i = 0 ; i < count ; i++ )
		cout << arr[i] << "  " ;
	cout << endl ;
}
void main( )
{
	array a ;
	a.add ( 25 ) ;
	a.add ( 17 ) ;
	a.add ( 31 ) ;
	a.add ( 13 ) ;
	a.add ( 2 ) ;
	cout << "\nSelection sort.\n" ;
	cout << "\nArray before sorting:" << endl ;
	a.display( ) ;
	a.sort( ) ;
	cout << "\nArray after selection sorting:" << endl ;
	a.display( ) ;
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-selection-sort-using-class/">C++ program to implement Selection sort using class</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-selection-sort-using-class/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Program to implement Linear Search algorithm</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/program-to-implement-linear-search-algorithm/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/program-to-implement-linear-search-algorithm/#respond</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Sun, 30 Jan 2011 11:41:44 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[Linear Search algorithm]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1221</guid>

					<description><![CDATA[<p>#include #include void read(int a[10],int n) { cout</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/program-to-implement-linear-search-algorithm/">Program to implement Linear Search algorithm</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="cpp">
#include<iostream.h>
#include<constream.h>
void read(int a[10],int n)
{
	cout<<"reading\n";
	for(int i=0;i<n;i++)
		cin>>a[i];
}
void display(int a[10],int n)
{
	for(int i=0;i<n;i++)
		cout<<a[i]<<"\t";
}
void linearsearch ( int a[10],int n  )
{
	int k,flag=0;
	read(a,n);
	display(a,n);
	cout<<"\nenter an element to be search\n";
	cin>>k;
	for(int i=0;i<n;i++)
	{
		if(a[i]==k)
			flag=1;
		break;
	}
	if(flag==1)
		cout << "\nsearching is  successful,element is found at position " << i +1<<endl;
	else
		cout<<"searching not successful\n";
}
void main()
{
	int a[10], n;
	clrscr();
	cout<<"enter n value..\n";
	cin>>n;
	linearsearch(a,n);
	getch();
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/program-to-implement-linear-search-algorithm/">Program to implement Linear Search algorithm</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/program-to-implement-linear-search-algorithm/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Program to represent Indirect Addressing of Linear List using Templates</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/program-to-represent-indirect-addressing-of-linear-list-using-templates/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/program-to-represent-indirect-addressing-of-linear-list-using-templates/#respond</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Sat, 29 Jan 2011 10:49:31 +0000</pubDate>
				<category><![CDATA[Data structure]]></category>
		<category><![CDATA[linked list]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[linear list]]></category>
		<category><![CDATA[templates]]></category>
		<category><![CDATA[Indirect Addressing]]></category>
		<category><![CDATA[indirect list]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1218</guid>

					<description><![CDATA[<p>IndirectList(int MaxLinearSize=10);<br />
~IndirectList();//destructor<br />
int IsEmpty()const{return length==0;}<br />
int Length()const{return length;}<br />
int Find(int k,T&#038;x)const;<br />
int Search(const T&#038;x)const;<br />
void Delete(int k,T&#038;x);<br />
void Insert(int k,const T&#038;x);<br />
void Output()const;</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/program-to-represent-indirect-addressing-of-linear-list-using-templates/">Program to represent Indirect Addressing of Linear List using Templates</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="cpp">
#include<iostream.h>
#include<constream.h>
template<class T>
class IndirectList
{
	private:
		int length;
		int MaxSize;
		T**table; 
	public:
		IndirectList(int MaxLinearSize=10);  	
		~IndirectList();//destructor
		int IsEmpty()const{return length==0;}
		int Length()const{return length;}
		int Find(int k,T&x)const;
		int Search(const T&x)const;
		void Delete(int k,T&x);

		void Insert(int k,const T&x);

		void Output()const;
};
	template<class T>
IndirectList<T>::IndirectList(int MaxListSize)
{
	MaxSize=MaxListSize;
	table=new T*[MaxSize];
	length=0;
}
	template<class T>
IndirectList<T>::~IndirectList()
{
	for(int i=0;i<length;i++)
		delete table[i];
	delete[]table;
}
template<class T>
int IndirectList<T>::Find(int k,T&x)const
{
	if(k<1||k>length)
		return 0; //no kth element
	if(x==*table[k-1])
		return 1;
	else
		return 0;
}
template<class T>
int IndirectList<T>::Search(const T&x)const
{
	for(int i=0;i<length;i++)
		if(*table[i]==x)
			return ++i;
	return 0;
}
	template<class T>
void IndirectList<T>::Delete(int k,T&x)
{
	if(Find(k,x))
	{
		for(int i=k;i<length;i++)
			table[i-1]=table[i];
		length--;
	}
	else
		cout<<"out of bounds\n";
}
	template<class T>
void IndirectList<T>::Insert(int k,const T&x)
{
	if(k<0||k>length)
		cout<<"out of bounds\n";
	if(length==MaxSize)
		cout<<"no memory\n";
	for(int i=length-1;i>=k;i--)
		table[i+1]=table[i];
	table[k]=new T;
	*table[k]=x;
	length++;
}
template<class T>
void IndirectList<T>::Output()const
{
	if(IsEmpty())
		cout<<"list is empty\n";
	else
		for(int i=0;i<length;i++)
			cout<<*table[i]<<"\t";
}
void menu()
{
	cout<<"\n MENU\n";
	cout<<"1.Length\n";
	cout<<"2.Find\n";
	cout<<"3.Search\n";
	cout<<"4.Delete\n";
	cout<<"5.Insert\n";
	cout<<"6.Output\n";
}
void main()
{
	int choice;
	int k,x,len,p;
	clrscr();
	IndirectList<int>obj;
	do
	{
		menu();
		cout<<"enter choice\n";
		cin>>choice;
		switch(choice)
		{
			case 1:
				len=obj.Length();
				if(len==0)
					cout<<"List is empty\n";
				else
					cout<<"length of Indirectlist is "<<len<<endl;
				break;
			case 2:
				cout<<"enter k,x(position and value)\n";
				cin>>k>>x;
				p=obj.Find(k,x);
				if(p==1)
					cout<<"found"<<endl;
				if(p==0)
					cout<<"not found"<<endl;
				break;
			case 3:
				cout<<"enter x(value)\n";
				cin>>x;
				p=obj.Search(x);
				if(p)
					cout<<"searching is sucessful and found at "<<p<<endl;
				else
					cout<<"searching not sucessful"<<endl;
				break;
			case 4:
				cout<<"enter k,x(position and value)\n";
				cin>>k>>x;
				obj.Delete(k,x);
				break;
			case 5:
				cout<<"enter k,x(index and value)\n";
				cin>>k>>x;
				obj.Insert(k,x);
				break;
			case 6:
				cout<<"elements in the list are:\n\n";
				obj.Output();
				break;
			default:
				cout<<"invalid choice\n";
		}
	}
	while(choice>=1&&choice<=6);
	getch();
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/program-to-represent-indirect-addressing-of-linear-list-using-templates/">Program to represent Indirect Addressing of Linear List using Templates</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/program-to-represent-indirect-addressing-of-linear-list-using-templates/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Program to implement linked representation of Linear list using templates</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/program-to-implement-linked-representation-of-linear-list-using-templates/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/program-to-implement-linked-representation-of-linear-list-using-templates/#respond</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Fri, 28 Jan 2011 10:47:11 +0000</pubDate>
				<category><![CDATA[Data structure]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[linear list]]></category>
		<category><![CDATA[templates]]></category>
		<category><![CDATA[linked list]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1214</guid>

					<description><![CDATA[<p>#include #include #include template class ChainNode { friend Chain; private: T data; ChainNode*link; }; template class Chain { private: ChainNode*first; public: Chain() { first=0; } ~Chain(); int IsEmpty()const; int Length()const; int Find(int k,T&#038;x); int Search(const T&#038;x); void Delete(int k,T&#038;x); void Insert(int k,const T&#038;x); void Output(); }; template Chain::~Chain() { ChainNode*next; while(first) { next=first->link; delete first;</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/program-to-implement-linked-representation-of-linear-list-using-templates/">Program to implement linked representation of Linear list using templates</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="cpp">
#include<iostream.h>
#include<constream.h>
#include<stdlib.h>
template<class T>
class ChainNode
{
	friend Chain<T>;
	private:
	T data;
	ChainNode<T>*link;
};
template<class T>
class Chain
{
	private:
		ChainNode<T>*first; 
	public:
		Chain()
		{
			first=0;
		}
		~Chain();
		int IsEmpty()const;
		int Length()const;
		int Find(int k,T&x);
		int Search(const T&x);
		void Delete(int k,T&x);
		void Insert(int k,const T&x);
		void Output();
};
	template<class T>
Chain<T>::~Chain()
{
	ChainNode<T>*next;
	while(first)
	{
		next=first->link;
		delete first;
		first=next;
	}
}
template<class T>
int Chain<T>::Length()const
{
	ChainNode<T>*current=first;
	int len=0;
	while(current)
	{
		current=current->link;
		len++;
	}
	return len;
}
	template<class T>
int Chain<T>::Find(int k,T&x)
	//set x to the kth element in the chain
	//return 0 if no kth element, return 1 otherwise
{
	if(k<1)
		return 0;
	ChainNode<T>*current=first;
	int index=1; //index of current
	while(index<k&#038;&#038;current)
	{
		current=current->link;
		index++;
	}
	if(current&&x==current->data)
		return 1;
	else
		return 0; //no kth element
}
	template<class T>
int Chain<T>::Search(const T&x)
{
	ChainNode<T>*current=first;
	int index=1; //index of current
	while(current&&current->data!=x)
	{
		current=current->link;
		index++;
	}
	if(current)
	{
		return index;
	}
	else
		return 0;
}
	template<class T>
void Chain<T>::Delete(int k,T&x)
{
	if(k<1||!first)
		cout<<"out of bounds\n"; //no kth element
	ChainNode<T>*p=first;
	if(k==1) //p is already at k
		first=first->link; //remove
	else
	{
		ChainNode<T>*q=first;
		for(int index=1;index<k-1&#038;&q;index++)
		{
			q=q->link;
		}
		if(!q||!q->link)
			cout<<"the element doesnot exist\n";
		p=q->link;
		q->link=p->link; //remove from linked list
		//free node p
		delete p;
	}

}
	template<class T>
void Chain<T>::Insert(int k,const T&x)
{
	if(k<0)
		cout<<"out of bounds\n"; //no kth element
	//p will be eventually to kth node
	ChainNode<T>*p=first;
	for(int index=1;index<k&#038;&p;index++)
		p=p->link;
	if(k>0&&!p)
		cout<<"out of bounds\n"; //no kth element
	ChainNode<T>*y=new ChainNode<T>;
	y->data=x;
	if(k)
	{
		//insert after p
		y->link=p->link;
		p->link=y;
	}
	else
	{
		y->link=first;
		first=y;
	}
}
	template<class T>
void Chain<T>::Output()
{
	ChainNode<T>*p=first;
	while(p)
	{
		cout<<p->data<<"\t";
		p=p->link;
	}
}


void menu()
{
	cout<<"\n MENU\n";
	cout<<"1.Length\n";
	cout<<"2.Find\n";
	cout<<"3.Search\n";
	cout<<"4.Delete\n";
	cout<<"5.Insert\n";
	cout<<"6.Output\n";
}
void main()
{
	int choice;
	int k,x,len,p;
	clrscr();
	Chain<int>obj;
	do
	{
		menu();
		cout<<"enter choice\n";
		cin>>choice;
		switch(choice)
		{
			case 1:
				len=obj.Length();
				if(len==0)
					cout<<"List is empty\n";
				else
					cout<<"length of linkedlist is "<<len<<endl;
				break;
			case 2:
				cout<<"enter k,x(position and value)\n";
				cin>>k>>x;
				p=obj.Find(k,x);
				if(p==1)
					cout<<"found"<<endl;
				if(p==0)
					cout<<"not found"<<endl;
				break;
			case 3:
				cout<<"enter x(value)\n";
				cin>>x;
				p=obj.Search(x);
				if(p)
					cout<<"searching is sucessful and found at "<<p<<endl;
				else
					cout<<"searching not sucessful"<<endl;
				break;
			case 4:
				cout<<"enter k,x(position and value)\n";
				cin>>k>>x;
				obj.Delete(k,x);
				break;
			case 5:
				cout<<"enter k,x(index and value)\n";
				cin>>k>>x;
				obj.Insert(k,x);
				break;
			case 6:
				cout<<"elements in the list are:\n\n";
				obj.Output();
				break;
			default:
				cout<<"invalid choice\n";
		}
	}
	while(choice>=1&&choice<=6);
	getch();
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/program-to-implement-linked-representation-of-linear-list-using-templates/">Program to implement linked representation of Linear list using templates</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/program-to-implement-linked-representation-of-linear-list-using-templates/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Program for Array Based Representation of Linear List using templates</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/program-for-array-based-representation-of-linear-list-using-templates/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/program-for-array-based-representation-of-linear-list-using-templates/#respond</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Thu, 27 Jan 2011 10:41:23 +0000</pubDate>
				<category><![CDATA[Data structure]]></category>
		<category><![CDATA[linked list]]></category>
		<category><![CDATA[templates]]></category>
		<category><![CDATA[linear list]]></category>
		<category><![CDATA[array]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1212</guid>

					<description><![CDATA[<p>LinearList(int MaxLinearSize=10);<br />
~LinearList(){delete[]element;}<br />
int isEmpty()const{return length==0;}<br />
int Length()const{return length;}<br />
int Find(int k,T&#038;x)const;<br />
int Search(const T&#038;x)const;<br />
void Delete(int k,T&#038;x);<br />
void Insert(int k,const T&#038;x);<br />
void Output()const;</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/program-for-array-based-representation-of-linear-list-using-templates/">Program for Array Based Representation of Linear List using templates</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="cpp">
#include<iostream.h>
#include<constream.h>
template<class T>
class LinearList
{
	private:
		int length;
		int MaxSize;
		T *element;
	public:
		LinearList(int MaxLinearSize=10);
		~LinearList(){delete[]element;}
		int isEmpty()const{return length==0;}
		int Length()const{return length;}
		int Find(int k,T&x)const;
		int Search(const T&x)const;
		void Delete(int k,T&x);
		void Insert(int k,const T&x);
		void Output()const;
};
	template<class T>
LinearList<T>::LinearList(int MaxListSize)
{
	MaxSize=MaxListSize;
	element=new T[MaxSize];
	length=0;
}
template<class T>
int LinearList<T>::Find(int k,T&x)const
{
	if(k<1||k>length)
		return 0;
	x=element[k-1];
	return 1;
}
template<class T>
int LinearList<T>::Search(const T&x)const
{
	for(int i=0;i<length;i++)
		if(element[i]==x)
			return ++i;
	return 0;
}
	template<class T>
void LinearList<T>::Delete(int k,T&x)
{
	if(Find(k,x))
	{
		for(int i=k;i<length;i++)
			element[i-1]=element[i];
		length--;
	}
	else
		cout<<"out of bounds\n";
}
	template<class T>
void LinearList<T>::Insert(int k,const T&x)
{
	if(k<0||k>length)
		cout<<"out of bounds\n";
	if(length==MaxSize)
		cout<<"no memory\n";
	for(int i=length-1;i>=k;i--)
		element[i+1]=element[i];
	element[k]=x;
	length++;
}
template<class T>
void LinearList<T>::Output()const
{
	if(isEmpty())
		cout<<"list is empty\n";
	else
		for(int i=0;i<length;i++)
			cout<<element[i]<<"\t";
}
void menu()
{
	cout<<"\n MENU\n" ;
	cout<<"-----------\n";
	cout<<"1.Length\n";
	cout<<"2.Find\n";
	cout<<"3.Search\n";
	cout<<"4.Delete\n";
	cout<<"5.Insert\n";
	cout<<"6.Output\n";
	cout<<"-------------\n";
}
void main()
{
	int ch;
	int k,x,len,p;
	clrscr();
	LinearList <int> obj;
	do
	{
		menu();
		cout<<"enter choice\t";
		cin>>ch;
		switch(ch) {
			case 1:
				len=obj.Length();
				if(len==0)
					cout<<"List is empty\n";
				else
					cout<<"length of linearlist is "<<len<<endl;
				break;
			case 2:
				cout<<"enter k,x(position and value)\n";
				cin>>k>>x;
				p=obj.Find(k,x);
				if(p==1)
					cout<<"found"<<endl;
				if(p==0)
					cout<<"not found"<<endl;
				break;
			case 3:
				cout<<"enter x(value)\n";
				cin>>x;
				p=obj.Search(x);
				if(p)
					cout<<"searching is sucessful and found at"<<p<<endl;
				else
					cout<<"searching not sucessful"<<endl;
				break;
			case 4:
				cout<<"enter k,x(position and value)\n";
				cin>>k>>x;
				obj.Delete(k,x);
				break;
			case 5:
				cout<<"enter k,x(index and value)\n";
				cin>>k>>x;
				obj.Insert(k,x);
				break;
			case 6:
				cout<<"elements in the list are:\n\n";
				obj.Output();
				break;
			default:
				cout<<"invalid choice\n";
				break;
		}  } while(ch>=1&&ch<=6);
		getch();
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/program-for-array-based-representation-of-linear-list-using-templates/">Program for Array Based Representation of Linear List using templates</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/program-for-array-based-representation-of-linear-list-using-templates/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
