a random element in array

Dec 16, 2013 at 12:03pm
Implement the QuickSort Algorithm; Your code should be in C++. The user should be allowed to choose between 3 options; which element considered a Pivot.
Pivot Choice 1: The last element in the list
Pivot Choice 2: The first element in the list
Pivot Choice 3: A random element in the array.


i solved the last element and the first element but i need your help plz to solve a random element
thank u
Dec 16, 2013 at 12:21pm
Read this:

http://www.cplusplus.com/reference/cstdlib/rand/

always put srand() at the top of main.

int Pivot_Choice_3 = rand() % number_of_elemnts_in_the_list;
Dec 16, 2013 at 8:30pm
thank u soooo much :$
Topic archived. No new replies allowed.