source/algorithms/quickSort.c
void quickSort(int vector[], int ending_index)
{
    ending_index--;
    int starting_index = 0, stack[ending_index-starting_index+1], top = -1;

    stack[++top] = starting_index;
    stack[++top] = ending_index;

    while (top >= 0)
    {
        ending_index = stack[top--];
        starting_index = stack[top--];

        int p = partition(vector, starting_index, ending_index);

        if((p-1) > starting_index)
        {
            stack[++top] = starting_index;
            stack[++top] = p - 1;
        }

        if((p+1) < ending_index)
        {
            stack[++top] = p + 1;
            stack[++top] = ending_index;
        }
    }
}
//Main Quick Sort function, uses a secondary function "swap".
//Receives a integer vector and it's size as input.

Main Quick Sort function, uses a secondary function "swap".
Receives a integer vector and it's size as input.
Main Quick Sort function uses a secondary function " swap " . Receives a integer vector and it ' s size as input .
void quickSort(int vector[], int ending_index)
{
    ending_index--;
    int starting_index = 0, stack[ending_index-starting_index+1], top = -1;
    stack[++top] = starting_index;
    stack[++top] = ending_index;
    while (top >= 0)
    {
        ending_index = stack[top--];
        starting_index = stack[top--];
        int p = partition(vector, starting_index, ending_index);
        if((p-1) > starting_index)
        {
            stack[++top] = starting_index;
            stack[++top] = p - 1;
        }
        if((p+1) < ending_index)
        {
            stack[++top] = p + 1;
            stack[++top] = ending_index;
        }
    }
}
void quickSort ( int vector [ ] , int ending_index ) { ending_index -- ; int starting_index = 0 , stack [ ending_index - starting_index + 1 ] , top = -1 ; stack [ ++ top ] = starting_index ; stack [ ++ top ] = ending_index ; while ( top >= 0 ) { ending_index = stack [ top -- ] ; starting_index = stack [ top -- ] ; int p = partition ( vector , starting_index , ending_index ) ; if ( ( p - 1 ) > starting_index ) { stack [ ++ top ] = starting_index ; stack [ ++ top ] = p - 1 ; } if ( ( p + 1 ) < ending_index ) { stack [ ++ top ] = p + 1 ; stack [ ++ top ] = ending_index ; } } }
Main Quick Sort function, uses a secondary function "swap".
Main Quick Sort function uses a secondary function " swap " .