From 41b6637d3b2c26066fae888f5aeb4a21624f7a4c Mon Sep 17 00:00:00 2001 From: Shine wOng <1551885@tongji.edu.cn> Date: Sun, 13 Oct 2019 16:01:54 +0800 Subject: [PATCH] a very bried conclusion on quicksort and shellsort. --- thu_dsa/chp12/quicksort.md | 22 ++++++++++++++++++++++ thu_dsa/chp12/shellsort.md | 16 ++++++++++++++++ words.md | 2 -- 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 thu_dsa/chp12/quicksort.md create mode 100644 thu_dsa/chp12/shellsort.md diff --git a/thu_dsa/chp12/quicksort.md b/thu_dsa/chp12/quicksort.md new file mode 100644 index 0000000..7048881 --- /dev/null +++ b/thu_dsa/chp12/quicksort.md @@ -0,0 +1,22 @@ +QuickSort总结 +============ + +## QuickSort基本思路 + ++ 分而治之的策略,类似于Mergesort ++ 但是与Mergesort不同的是,Quicksort是在划分的时候做文章,主要操作是划分partition操作;而Mergesort划分的时候直接简单划分,主要操作是合并merge操作。 ++ 递归实现 + +## 轴点的构造 + ++ 简单取第一个元素 ++ 随机选取 ++ 三者取中法 + +## 划分的策略 + ++ 版本一:难以应对退化的情形 ++ 版本二:可以处理退化,但是稳定性更差 ++ 版本三:稳定性更好,但是仍然是不稳定的算法。不能应对退化情形 + +## 平均情况下时间复杂度的证明 diff --git a/thu_dsa/chp12/shellsort.md b/thu_dsa/chp12/shellsort.md new file mode 100644 index 0000000..edd19fe --- /dev/null +++ b/thu_dsa/chp12/shellsort.md @@ -0,0 +1,16 @@ +Shellsort总结 +============ + +## ShellSort基本概念 + +以不同的步长进行多次插入排序。它的时间性能主要受到步长的选取的影响 + +## 步长的选择 + ++ 说明shell序列的缺点 ++ 邮资问题 ++ g-有序的向量,经过h-排序后,仍然保持g-有序的证明(习题集) ++ 利用上述结论,可以证明几个序列的时间复杂度 + - Papernov + - Pratt + - Sedgewick diff --git a/words.md b/words.md index 633803f..c8de90e 100644 --- a/words.md +++ b/words.md @@ -1349,5 +1349,3 @@ Some Words - Lucy soothed the baby by rocking it in her arms. - She made a cup of tea to soothe her nerves. - Massage can gently soothe away your aches and pains. - -