Free Tutorials, Linux Command, Source Code Architecture,  Software Engineering, Intelligent Systems, RDBMS, Computer Accounting,  Operations Research, Discrete Mathematics, Network, SAD Lay Networks Lay Networks
Computer Science Networking Operating Systems Linux and Unix Source Code Script & Languages Protocols Glossary
Web laynetworks.com
Google
 


TMA 2002

Q Sort Program in C++

#include <iostream.h>
#include<stdlib.h>
#include <process.h>
#include <conio.h>
class SortList
{
private :
int *list;
int size;
public :
SortList(int size)
{
list=new int[size];
this->size=size;
}
void Swap(int i,int j)
{
int tmp;
tmp=list[i];
list[i]=list[j];
list[j]=tmp;
}
void SortList::QuickSort(int,int);
void StoreNum(int);
void Display();
};
void SortList::StoreNum(int x)
{
static int i=0;
*(list+i)=x;
i++;
}
void SortList::Display()
{
int i=0;
for(;i<size;i++)
cout<<*(list+i)<<" ";
}
void SortList::QuickSort(int X,int I)
{
int L,R,V;
if (I>X)
{
V=list[I];
L=X-1;
R=I;
for(;;)
{
while(list[++L]>V);
while(list[--R]<V);
if (L==R) break;
Swap(L,R);
}
Swap(L,I);
QuickSort(X,L-1);
QuickSort(L+1,I);
}
}

void main()
{
int i,x,n;
SortList *S;
clrscr();
cout<<endl<<"\t"<<"Program for Quick Sort"<<endl;
cout<<endl<<"How many numbers to be sorted : ";
cin>>n;
S=new SortList(n);
for(i=0;i<n;i++)
{
cout<<endl<<"Enter number : ";
cin>>x;
S->StoreNum(x);
}
cout<<endl<<"Numbers entered are "<<endl;
S->Display();
S->QuickSort(1,n-1);
cout<<endl<<"Numbers After QuickSort are "<<endl;
S->Display();
}

Object Oriented System_Q Sort Program in C++.htm


Next is Sparse Matrix

Top

Back
Next
FDDI Frequently Asked Questions (FAQ), The function and frame format of FDDI,Aloha,Comparative analysis between two types of ATM Switches,Knockout Switch,Barcher-Banyan Switch,Various popular standards for compressing multimedia data,Distributed Multimedia Survey: Standards, ASCII to hex value chart,Comparative analysis - TCP - UDP, Addressing Formats and QoS parameters, Bellman Ford's Algorithm Lay networks, free, java, java script, asp, vb, linux, ignou, tutorial, Unix commands, System Analysis, System Design, Ipv6, quiz, download, free, Computer Architecture, Object Oriented System, Relational Database Management Systems, Object Oriented System, Operating Systems, Software Engineering, Communications and Networks, Discrete Mathematics, Intelligent Systems, Operations Research, Accounting and Finance on Computersmca, networking, protocols, glossary, assignment, project, tma, programming source code, programming, source code, unix, free
 
Book Mark/Share this site at BlinkBits BlinkList Blogmarks co.mments Delicious Digg Fark Furl it! Google Ma.gnolia Netvouz NewsVine RawSugar Reddit Shadows Simpy Stumble Technorati YahooMyWeb

Copyright © 2000- 2007 Lay Networks All rights reserved. 
This website is best viewed in Firefox 1.0.1 above.

Web Hosting sponsored by Customized Software Company India
Web Site Designed by Web Designing, Flash Animation, Multimedia Presentations, Broacher/catalogue designing, Web Promotion 
Refer to your freind About Us Legal IGNOU Contact Us Feedback Donate to laynetworks.com Download Management Tutorials Tutorials History Search here