Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include"vectordinamico.h"
- unsigned long choose_pivot(unsigned long i, unsigned long j){
- return((i+j)/2);
- }
- void quicksort(vectorP *pvector, unsigned long beg, unsigned long end){
- if(end>beg+1){
- TELEMENTO piv= recuperar(*pvector,beg);
- unsigned long l= beg+1,r=end;
- while(l<r){
- if(recuperar(*pvector,l)<=piv)
- l++;
- else{
- r--;
- swap(pvector,l,r);
- }
- }
- l--;
- swap(pvector,l,beg);
- quicksort(pvector,beg,l);
- quicksort(pvector,r,end);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement