Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

快速排序算法中,和看到的c的实现不一样 #68

Open
@niezuxue

Description

@niezuxue

在一本算法结构的书中,介绍的快速排序,每一趟排序都会去交换。
但这里的好像只是找到了比基准值大的和小的两个数组,然后最后再去合并。
书上的c的实现:
`int Quick(List R, int low, int high)
{
x=R[low];

while(low<high){while((low<high) && R[high].key >= x.key) {high --;}R[low] = R[high];while(low<high && R[low].key <= x.key){low++;}R[high] = R[low];}R[low] = x;return low;

}

void QuickSort(List R, int low, int high)
{
if (low < high)
{
temp = Quick(R, low, high);
QuickSort(R, low, temp - 1);
QuickSort(R, temp + 1, high);
}
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp