我首先自己编写代码并尝试从互联网上复制粘贴并实施其他快速排序代码。这些都没有奏效。
void quickSort (char** tmpDictionary, int left, int right) {
int pivot, i, j;
char tmp[BUFFER_LENGTH];
if (right > left) {
pivot = left;
i = left;
j = right;
while (i < j) {
while ((strcmp(tmpDictionary[pivot], tmpDictionary[i]) >= 0) && (right > i)) {
i++;
}
while ((strcmp(tmpDictionary[j], tmpDictionary[pivot]) == 1)) {
j--;
}
if (i < j) {
printf("%s ile %s yer degistiriyor.\n", tmpDictionary[i], tmpDictionary[j]);
strcpy(tmp, tmpDictionary[i]);
strcpy(tmpDictionary[i], tmpDictionary[j]);
strcpy(tmpDictionary[j], tmp);
quickSort(tmpDictionary, left, j-1);
quickSort(tmpDictionary, j+1, right);
}
}
}
}
我在这里做错了什么?