Submission #19229

# Submission time Handle Problem Language Result Execution time Memory
19229 2016-02-21T13:04:45 Z middleageddr 짝수 정렬 (tutorial3) C++
Compilation error
0 ms 0 KB
#include "grader.h"

void q_sort(int left, int right, int *A) {
	int i, j, pivot;
	int temp;

	i = pivot = left;
	j = right;

	if (i < j) {

		while (i < j) {
			while ((i < j) && (*(A + i) < *(A + pivot))) i++;
			while ((i < j) && (*(A + j) >= *(A + pivot))) j--;

			if (i < j) {
				temp = *(A + i);
				*(A + i) = *(A + j);
				*(A + j) = temp;
			}
		}

		temp = *(A + pivot);
		*(A + pivot) = *(A + j);
		*(A + j) = temp;
		
		q_sort(left, j - 1);
		q_sort(j + 1, right);
	}


}

Compilation message

tutorial3.cpp: In function ‘void q_sort(int, int, int*)’:
tutorial3.cpp:27:21: error: too few arguments to function ‘void q_sort(int, int, int*)’
   q_sort(left, j - 1);
                     ^
tutorial3.cpp:3:6: note: declared here
 void q_sort(int left, int right, int *A) {
      ^
tutorial3.cpp:28:22: error: too few arguments to function ‘void q_sort(int, int, int*)’
   q_sort(j + 1, right);
                      ^
tutorial3.cpp:3:6: note: declared here
 void q_sort(int left, int right, int *A) {
      ^