全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Merge, merge sort?

又称: merge (of sorted lists) · merge sort · merge (of sorted sequences)

Definition 27.3 High School Computer Science · 第 27 章 — Divide and Conquer

To merge two sorted lists is to make one sorted list of all their elements, by repeatedly moving the smaller of their two first elements to the output. Merge sort sorts a list by splitting it into two halves, sorting each by merge sort, and merging the results; a list of 00 or 11 element is already sorted.

One step of merge. The grey elements are already in out, which is sorted and holds the smallest of a and of b. Only a[i] and b[j] are compared: the smaller is the next element.
One step of merge. The grey elements are already in out, which is sorted and holds the smallest of a and of b. Only a[i] and b[j] are compared: the smaller is the next element.
Merge sort on eight numbers: three levels of splitting, then three levels of merging (shaded). Each level of merging handles all eight numbers once.
Merge sort on eight numbers: three levels of splitting, then three levels of merging (shaded). Each level of merging handles all eight numbers once.
在原文中阅读 →
Definition 19.7 University Computer Science — Year 1 · 第 19 章 — Sorting

To merge two sorted sequences is to build the sorted sequence of their elements by repeatedly taking the smaller of their two first elements. Merge sort sorts the two halves of an array recursively and merges them.

在原文中阅读 →