Created
November 13, 2017 15:55
-
-
Save VictorSouzas/2c64f22aa255b8d5f1f32087956feb8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int partition(int min, int max) { | |
int pivot = this.vector[max]; | |
int wall = min-1; | |
for (int i = min; i <= max-1; i++){ | |
if(this.vector[i] <= pivot){ | |
wall++; | |
swap(wall,i); | |
} | |
} | |
swap(wall + 1, max); | |
return wall+1; | |
} | |
private void swap(int wall, int i) { | |
int aux = this.vector[wall]; | |
this.vector[wall] = this.vector[i]; | |
this.vector[i] = aux; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment