//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@ Yap Hui Wen @ //@ 99006448 @ //@ IFDS Assignment 4 @ //@ Last Edited: 24 March 2002 @ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ #include #include #include const int MAX=200000; //maximum list size /******************************************************************/ int Acceptlist(int i) { int value[MAX]; cin>>value[i]; return value[i]; } /******************************************************************/ //Display Unsorted List void DisplayUnsortedList(int unsorted[],int size) { cout<<"Unsorted List:\n=======\n"; for(int z=0;z void QuickSort(ElementType x[], int first, int last) { int pos; //position of pivot if(first void Split(ElementType y[],int first, int last, int &pos) { ElementType pivot=y[first]; //pivot element int left=first; //index for left search bool onCorrectSide; ++first; do{ onCorrectSide=true; while (onCorrectSide){ //move from left to right if(y[first]>pivot) onCorrectSide=false; else{ ++first; onCorrectSide=(first<=last); } } onCorrectSide=(first<=last); while(onCorrectSide){ //move from right to left if(y[last]<=pivot) onCorrectSide=false; else{ --last; onCorrectSide=(first<=last); } } if(first void Swap(ElementType &a,ElementType &b) { ElementType temp=a; a=b; b=temp; } /******************************************************************/ //Display Sorted List void Display(int listb[],int e) { cout<<"Sorted List:\n=======\n"; for(int q=0;q