Browsing articles in "Programming"
Nov
28
2008

C++ Program to implement a single linked list

C++ Program to implement a single linked list and Perform the following operations. /************************************************************** Author: Arun Vishnu M V Web: www.arunmvishnu.com Description: C++ Program to implement a single linked list and Perform the following operations 1: Insertioin 2: Deletion 3: Display ***************************************************************/ #include<conio.h> #include<iostream.h> #include<process.h>   // Creating a NODE Structure struct node { int data; // data struct node *next,*start; // link to next node and previous node };   // Creating a class [...]

Nov
28
2008

C++ Program for Selection sort

C++ Program for Selection sort . /************************************************************** Author: Arun Vishnu M V Web: www.arunmvishnu.com Description: C++ Program for Selection sort . ***************************************************************/ #include<conio.h> #include<iostream.h> #include<process.h>   void main() { int array[100],n,i,j,temp; clrscr(); cout<<"How many numbers–> "; cin>>n; cout<<"Enter "<<n<<" numbers\n"; for(i=0;i<n;i++) cin>>array[i]; for(i=0;i<n;i++) { for(j=i+1;j<n;j++) if(array[i]>array[j]) { temp=array[i]; array[i]=array[j]; array[j]=temp; } } cout<<"\nArray is sorted in ascending order.\n"; for(i=0;i<n;i++) cout<<array[i]<<" "; getch(); } //———————- END——————–

Nov
28
2008

C++ Program for QUICK SORT

C++ Program for QUICK SORT. /************************************************************** Author: Arun Vishnu M V Web: www.arunmvishnu.com Description: C++ Program for QUICK SORT. ***************************************************************/ #include<conio.h> #include<iostream.h> #include<process.h>   void quickSort(int numbers[], int array_size); void q_sort(int numbers[], int left, int right);   int numbers[150];   int main() { clrscr(); int i,n; cout<<"How many numbers you want to sort: "; cin>>n; cout<<"Enter "<<n<<" numbers.\n"; for (i = 0; i<n; i++) cin>>numbers[i]; //perform quick sort on array q_sort(numbers,0,n-1);   cout<<"Numbers are sorted\n"; [...]

Nov
28
2008

C++ Program to implement a QUEUE using linked list

C++ Program to implement a QUEUE using linked list. /************************************************************** Author: Arun Vishnu M V Web: www.arunmvishnu.com Description: C++ Program to implement a QUEUE using linked list. ***************************************************************/ #include<conio.h> #include<iostream.h> #include<process.h> #include<malloc.h>   // Creating a NODE Structure struct node { int data; struct node *next; };   // Creating a class QUEUE class queue { struct node *frnt,*rear; public: queue() // constructure { frnt=rear=NULL; } void insert(); // to insert an element void del(); [...]

Nov
28
2008

C++ Program to implement a Queue using array

C++ Program to implement a Queue using array. /************************************************************** Author: Arun Vishnu M V Web: www.arunmvishnu.com Description: C++ Program to implement a Queue using array. ***************************************************************/ #include<conio.h> #include<iostream.h> #include<process.h>   # define MAX_SIZE 150   class queues { int front,rear; int queue[MAX_SIZE]; public: queues() // Constructor { front=(-1); rear=(-1); } void insert_rear(int); void delete_front(); void display(); };   void queues::insert_rear(int item) { if((front==0 && rear==MAX_SIZE) || (front==(rear+1))) { cout<<"Queue is full!\nOverflow"; getch(); exit(0); } else [...]

Nov
28
2008

C++ Program to Add and subtract two polynomials

C++ Program to Add and subtract two polynomials. /************************************************************** Author: Arun Vishnu M V Web: www.arunmvishnu.com Description: C++ Program to Add and subtract two polynomials. ***************************************************************/ #include<conio.h> #include<ostream.h> #include<process.h> // Creating a NODE Structure struct node { int coe,exp; // data struct node *next; // link to next node and previous node };   // Creating a class Polynomial class polynomial { struct node *start,*ptrn,*ptrp; public: void get_poly(); // to get a polynomial void show(); [...]

Nov
28
2008

C++ Program to Multiply two polynomials using linked list

C++ Program to Multiply two polynomials using linked list. /************************************************************** Author: Arun Vishnu M V Web: www.arunmvishnu.com Description: C++ Program to Multiply two polynomials using linked list. ***************************************************************/ #include<conio.h> #include<iostream.h> #include<process.h> // Creating a NODE Structure struct node { int coe,exp; // data struct node *next; // link to next node and previous node }; // Creating a class Polynomial class polynomial { struct node *start,*ptrn,*ptrp; public: void get_poly(); // to get a polynomial void [...]

Nov
28
2008

Students list and sort them in C++

C++ Program to make a students list and sort them according to there names, Sort using Merge Sort. /************************************************************** Author: Arun Vishnu M V Web: www.arunmvishnu.com Description: C++ Program to make a students list and sort them according to there names, Sort using Merge Sort.. ***************************************************************/ #include<conio.h> #include<iostream.h> #include<string.h> struct student { char name[20]; int sem; int regno; float mark; }; struct student students[75]; void msort(int low,int high) // Recursive unction megrge sort { int [...]

Nov
28
2008

Merge two ordered linked list

Merge two ordered linked list to form a 3rd sorted list using C++ /************************************************************** Author: Arun Vishnu M V Web: www.arunmvishnu.com Description: Merge two oredered linked list to form a 3rd sorted list using C++. ***************************************************************/ #include<conio.h> #include<iostream.h> #include<process.h> // Creating a NODE Structure struct node { int data; // data struct node *next; // link to next node and previous node }; // Creating a class LIST class list { struct node *start; public: [...]

Nov
28
2008

C++ Program for MERGE SORT

C++ Program for MERGE SORT /************************************************************** Author: Arun Vishnu M V Web: www.arunmvishnu.com Description: C++ Program for MERGE SORT . ***************************************************************/ #include<conio.h> #include<iostream.h> void m_sort(int numbers[], int temp[], int left, int right); void merge(int numbers[], int temp[], int left, int mid, int right); int numbers[150]; int temp[150]; int main() { clrscr(); int i,n; coutn; cout

Pages:«123»

Archives

Highslide for Wordpress Plugin