C++ program to implement circular queue using array

Wednesday, February 2nd, 2011  »  Posted By  »  Total 5 Comments

#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 = […]

C++ program to implement Heap sort Algorithm

Tuesday, February 1st, 2011  »  Posted By  »  Total 10 Comments

#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 […]

C++ program to implement Quick sort Algorithm using class

Tuesday, February 1st, 2011  »  Posted By  »  Total 8 Comments

#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 ) […]

C++ rogram to implement merge sort

Tuesday, February 1st, 2011  »  Posted By  »  Total 2 Comments

#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( ) […]

C++ program to implement Insertion sort using class

Tuesday, February 1st, 2011  »  Posted By  »  Total 2 Comments

#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 = […]

C++ program to implement Selection sort using class

Tuesday, February 1st, 2011  »  Posted By  »  Total 2 Comments

#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 = […]

Program to implement Linear Search algorithm

Sunday, January 30th, 2011  »  Posted By  »  Total 0 Comment

#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 […]

Program to represent Indirect Addressing of Linear List using Templates

Saturday, January 29th, 2011  »  Posted By  »  Total 0 Comment

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;

Program to implement linked representation of Linear list using templates

Friday, January 28th, 2011  »  Posted By  »  Total 0 Comment

#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) { […]

Program for Array Based Representation of Linear List using templates

Thursday, January 27th, 2011  »  Posted By  »  Total 0 Comment

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;

Question and Answer
C/C++ Unix & Linux Wordpress
Source codes
C C++ Java

Free email signup

Email: