zhijieerchapaixi
所属分类:Windows编程
开发工具:C/C++
文件大小:3KB
下载次数:0
上传日期:2019-03-04 14:53:14
上 传 者:
4597021
说明: 分析:
最坏时间复杂度为数组为逆序时,为O(n^2)。最优时间复杂度为数组正序时,为O(n)。平均时间复杂度为O(n^2)。辅助空间O(1)。稳定性:稳定。
基本思想:和交换排序不同的是它不用进行交换操作,而是用一个临时变量存储当前值。当前面的元素比后面大时,先把后面的元素存入临时变量,前面元素的值放到后面元素位置,再到最后把其值插入到合适的数组位置。
(Analysis:
The worst time complexity is O (n ^ 2) when the array is in reverse order. The optimal time complexity is O (n) when the array is in positive order. The average time complexity is O (n ^ 2). Auxiliary space O(1). Stability: Stability.
Fundamental idea: Unlike exchange ordering, it uses a temporary variable to store the current value instead of a swap operation. When the current element is larger than the latter, the latter element is stored in a temporary variable, the former element's value is placed in the latter element's position, and then the latter element's value is inserted into the appropriate array position.)
文件列表:
zhijieerchapaixi.cpp (5994, 2019-03-04)
近期下载者:
相关文件:
收藏者: