Ask Question
21 September, 20:32

int foo (int A[], int left, int right) { int i, x, q, N; if (right < = left) return 1; x = 0; for (i=left; i < = right; i++) x + = A[i] % 2; / / busy work ... N = right-left+1; q = left + (N/3); return x + foo (A, left, q) + foo (A, q+1, right);

+4
Answers (1)
  1. 21 September, 22:09
    0
    quicksort. cpp

    void quickSort (int arr[], int left, int right) {

    int i = left, j = right;

    int tmp;

    int pivot = arr[ (left + right) / 2];

    / * partition * /

    while (i < = j) {

    while (arr[i] < pivot)

    i++;

    while (arr[j] > pivot)

    j--;

    if (i < = j) {

    tmp = arr[i];

    arr[i] = arr[j];

    arr[j] = tmp;

    i++;

    j--;

    }

    };

    / * recursion * /

    if (left < j)

    quickSort (arr, left, j);

    if (i < right)

    quickSort (arr, i, right);

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “int foo (int A[], int left, int right) { int i, x, q, N; if (right < = left) return 1; x = 0; for (i=left; i < = right; i++) x + = A[i] % ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers