Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void trierRapide()
- {
- trierRapide(0,nbElt-1);
- }
- private int partition(int deb,int fin)
- {
- int compt = deb;
- int pivot = tab[deb];
- for(int i=deb+1;i<=fin;i++)
- {
- if (tab[i]<pivot)
- {
- compt++;
- permuter(compt,i);
- }
- }
- permuter(deb,compt);
- return compt;
- }
- private void trierRapide(int deb,int fin)
- {
- if(deb<fin)
- {
- int positionPivot=partition(deb,fin);
- trierRapide(deb,positionPivot-1);
- trierRapide(positionPivot+1,fin);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement