首页 > 解决方案 > c中的快速排序文件处理

问题描述

大家好,我是 c 编程的新手,我从一本书中得到了这段代码,我试图弄清楚这段代码是什么意思,谁能解释一下?谢谢

    int partition (struct Data data[1000], int low, int high) {
      int pivot = data[high].G3;
      int i = (low - 1);

      for (int j = low; j <= high- 1; j++) {
        if (data[j].G3 > pivot) {
            i++;
            swap(&data[i], &data[j]);
        }
      }
      swap(&data[i + 1], &data[high]);
      return (i + 1);
    }

标签: cloopsfilesortingstruct

解决方案


推荐阅读