Pairwise sorting-成对排序

Pairwise Sorting Network是由Ian Parberry在1992年提出的,具有与Odd-Even Mergesort相同的比较器成本和延迟。该排序网络通过按奇偶性分组并递归地减小子组长度,最终将每个子组排序并组合来实现排序。这是一种并行处理技术,可用于高效地排序数据。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The pairwise sorting network is a sorting network discovered and published by Ian Parberry in 1992 in Parallel Processing Letters.[1] The pairwise sorting network has the same cost (number of comparators) and delay as the odd-even mergesort network.

Pairwise sorting network
Visualization of the Pairwise sorting network with 16 inputs
Visualization of the Pairwise sorting network with 16 inputs
ClassSorting algorithm
Data structureArray
Worst-case performance(log⁡n)(log⁡n+1)/2{\displaystyle (\log n)(\log n+1)/2}(\log n)(\log n+1)/2 parallel time
Worst-case space complexityn(log⁡n)(log⁡n−1)/4+n−1{\displaystyle n(\log n)(\log n-1)/4+n-1}n(\log n)(\log n-1)/4+n-1 non-parallel time

以上来自维基百科。

个人理解:

一、分组:

按照奇数偶数分组,长度减半。

两个sub-组 继续按奇数偶数分组,until 子组长度为1.

二、组合:

将分组排序,组合。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值