Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- void Quick(int* A,int ts,int tb,int pivot)
- {
- while(ts>tb)
- {
- while(A[tb]<=A[pivot])
- {
- tb++;
- }
- while(A[ts]>A[pivot])
- {
- ts--;
- }
- if(tb<ts)
- {
- swap(A[tb],A[ts]);
- }
- }
- swap(A[ts],A[pivot]);
- }
- int main()
- {
- int A[]={20,30,10,40,50,5,100,80};
- int z=sizeof(A)/sizeof(A[0]);
- Quick(A,0,z-1,0);
- for(int i=0;i<z;i++)
- cout<<A[i]<<",";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement