<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Sort on Chunixz情报中心</title>
    <link>https://chunixz.github.io/tags/sort/</link>
    <description>Recent content in Sort on Chunixz情报中心</description>
    <image>
      <title>Chunixz情报中心</title>
      <url>https://chunixz.github.io/%3Clink%20or%20path%20of%20image%20for%20opengraph,%20twitter-cards%3E</url>
      <link>https://chunixz.github.io/%3Clink%20or%20path%20of%20image%20for%20opengraph,%20twitter-cards%3E</link>
    </image>
    <generator>Hugo -- gohugo.io</generator><atom:link href="https://chunixz.github.io/tags/sort/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Algorithms 十大排序算法总结</title>
      <link>https://chunixz.github.io/posts/2019-03-14-1/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://chunixz.github.io/posts/2019-03-14-1/</guid>
      <description>1. 排序算法分类 在计算机科学所使用的排序算法通常被分类为:
计算的时间复杂度（最差、平均、和最好性能），依据列表（list）的大小(n)。一般而言，好的性能是 O(nlogn)(大O符号)，坏的性能是 O(n^2)。对于一个排序理想的性能是 O(n)，但平均而言不可能达到。基于比较的排序算法对大多数输入而言至少需要 O(nlogn)。 内存使用量（以及其他计算机资源的使用）。 稳定性：稳定排序算法会让原本有相等键值的纪录维持相对次序。也就是如果一个排序算法是稳定的，当有两个相等键值的纪录 R和 S，且在原本的列表中 R出现在 S之前，在排序过的列表中 R也将会是在 S之前。 依据排序的方法：插入、交换、选择、合并等等。 1.1 稳定性 稳定排序算法会依照相等的关键（换言之就是值）维持纪录的相对次序。也就是一个排序算法是稳定的，就是当有两个有相等关键的纪录R和S，且在原本的串行中R出现在S之前，在排序过的串行中R也将会是在S之前。
1.2 计算复杂度 依据串行（list）的大小（n），一般而言，好的表现是O(nlogn)，且坏的行为是O(n2)。对于一个排序理想的表现是O(n)。仅使用一个抽象关键比较运算的排序算法总平均上总是至少需要O(nlogn)。 所有基于比较的排序的时间复杂度至少是 O(nlogn)。 1.3 常用排序算法 排序方法 时间复杂度（平均） 时间复杂度（最坏） 时间复杂度（最好） 空间复杂度 稳定性 冒泡排序 O(n^2) O(n^2) O(n) O(1) 稳定 插入排序 O(n^2) O(n^2) O(n) O(1) 稳定 选择排序 O(n^2) O(n^2) O(n^2) O(1) 不稳定 快速排序 O(nlogn) O(n^2) O(nlogn) O(nlogn) 不稳定 希尔排序 O(nlogn) O(n^2) O(n) O(1) 不稳定 堆排序 O(nlogn) O(nlogn) O(nlogn) O(1) 不稳定 归并排序 O(nlogn) O(nlogn) O(nlogn) O(n) 稳定 桶排序 O(n+k) O(n^2) O(n) O(n+k) 稳定 基数排序 O(n*k) O(n*k) O(n*k) O(n+k) 稳定 计数排序 O(n+k) O(n+k) O(n+k) O(n+k) 稳定 2.</description>
    </item>
    
  </channel>
</rss>
