Internal Sorting: Merge exchange sort: Sorting by Exchanging

本文详细介绍了归并交换排序(Merge Exchange Sort)的工作原理,通过动画展示、复杂度分析、算法M的步骤解析、流程图、数据表格以及Java程序实例,全面阐述了该排序算法的过程和应用。归并交换排序通过不断比较和交换元素,最终实现列表的有序排列。
摘要由CSDN通过智能技术生成

Merge exchange sort:归并交换排序


Animation

这里写图片描述
An example of merge sort. First divide the list into the smallest unit (1 element), then compare each element with the adjacent list to sort and merge the two adjacent lists. Finally all the elements are sorted and merged.


这里写图片描述
Merge sort animation. The sorted elements are represented by dots.


这里写图片描述
A recursive merge sort algorithm used to sort an array of 7 integer values. These are the steps a human would take to emulate merge sort (top-down).


Complexity

Class Sorting algorithm
Data structure Array
Worst case performance O(nlogn)
Best case performance O(nlogn) typical, O(n) natural variant
Average case performance O(nlogn)
Worst case space complexity О(n) total, O(n) auxiliary

Algorithm M

Algorithm M (Merge exchange). Records R1,...,RN are rearranged in place;
after sorting is complete their keys will be in order, K1<=...<=KN . We assume
that N>=2

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值