Created
January 11, 2019 11:07
-
-
Save YassineBajdou/f9ff30e644f3b89fb84af2f447a4d883 to your computer and use it in GitHub Desktop.
Quick Sort
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
int rand_partition ( int A[ ] , int start , int end ) { | |
//chooses position of pivot randomly by using rand() function . | |
int random = start + rand( )%(end-start +1 ) ; | |
swap ( A[random] , A[start]) ; //swap pivot with 1st element. | |
return partition(A,start ,end) ; //call the above partition function | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment