Skip to content

Commit ab6a8cd

Browse files
committed
remove workaround for multilingual shared-files since gitbook 3.0
1 parent 1f21fdf commit ab6a8cd

44 files changed

Lines changed: 48 additions & 49 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

LANGS.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
* [English](en/)
22
* [繁體中文](zh-tw/)
33
* [简体中文](zh-hans/)
4-
* [Shared Files](shared-files/)

zh-hans/basics_data_structure/binary_tree.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class TreeNode {
6060

6161
如果已知中序遍历和前序遍历或者后序遍历,那么就可以完全恢复出原二叉树结构。其中最为关键的是前序遍历中第一个一定是根,而后序遍历最后一个一定是根,中序遍历在得知根节点后又可进一步递归得知左右子树的根节点。但是这种方法也是有适用范围的:元素不能重复!否则无法完成定位。
6262

63-
![Binary Tree Traversal](https://raw.githubusercontent.com/billryan/algorithm-exercise/master/shared-files/images/binary_tree_traversal.png)
63+
![Binary Tree Traversal](../../shared-files/images/binary_tree_traversal.png)
6464

6565
### Python
6666

zh-hans/basics_data_structure/heap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
其中步骤1是给步骤2和3用的。
2323

24-
![Heapsort-example](https://raw.githubusercontent.com/billryan/algorithm-exercise/master/shared-files/images/Heapsort-example.gif)
24+
![Heapsort-example](../../shared-files/images/Heapsort-example.gif)
2525

2626
## Python
2727

zh-hans/basics_data_structure/huffman_compression.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
则对各符号进行霍夫曼编码的动态演示如下图所示。基本步骤是将出现频率由小到大排列,组成子树后频率相加作为整体再和其他未加入二叉树中的节点频率比较。加权路径长为节点的频率乘以树的深度。
1515

16-
![Huffman](https://raw.githubusercontent.com/billryan/algorithm-exercise/master/shared-files/images/huffman_algorithm.gif)
16+
![Huffman](../../shared-files/images/huffman_algorithm.gif)
1717

1818

1919
### Python 实现

zh-hans/basics_sorting/bubble_sort.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
核心:**冒泡**,持续比较相邻元素,大的挪到后面,因此大的会逐步往后挪,故称之为冒泡。
44

5-
![Bubble Sort](https://raw.githubusercontent.com/billryan/algorithm-exercise/master/shared-files/images/bubble_sort.gif)
5+
![Bubble Sort](../../shared-files/images/bubble_sort.gif)
66

77
## Implementation
88

zh-hans/basics_sorting/heap_sort.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
其中步骤1是给步骤2和3用的。
1414

15-
![Heapsort-example](https://raw.githubusercontent.com/billryan/algorithm-exercise/master/shared-files/images/Heapsort-example.gif)
15+
![Heapsort-example](../../shared-files/images/Heapsort-example.gif)
1616

1717
建堆时可以自顶向下,也可以采取自底向上,以下先采用自底向上的思路分析。我们可以将数组的后半部分节点想象为堆的最下面的那些节点,由于是单个节点,故显然满足二叉堆的定义,于是乎我们就可以从中间节点向上逐步构建二叉堆,每前进一步都保证其后的节点都是二叉堆,这样一来前进到第一个节点时整个数组就是一个二叉堆了。下面用 C++/Java 实现一个堆的类。C++/Java 中推荐使用 PriorityQueue 来使用堆。
1818

zh-hans/basics_sorting/insertion_sort.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
- 最坏情况下需要~N^2/2次比较和~N^2/2次交换,最好情况下需要N-1次比较和0次交换。
1919
- 平均情况下需要~N^2/4次比较和~N^2/4次交换
2020

21-
![Insertion Sort](https://raw.githubusercontent.com/billryan/algorithm-exercise/master/shared-files/images/insertion_sort.gif)
21+
![Insertion Sort](../../shared-files/images/insertion_sort.gif)
2222

2323

2424
## Implementation

zh-hans/basics_sorting/merge_sort.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
先来看看动图,归并排序是一种典型的分治应用。
66

7-
![Merge Sort](https://raw.githubusercontent.com/billryan/algorithm-exercise/master/shared-files/images/merge_sort.gif)
7+
![Merge Sort](../../shared-files/images/merge_sort.gif)
88

99
### Python
1010

zh-hans/basics_sorting/quick_sort.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ $$\sum _{i=0} ^{} \frac {n}{2^i} = 2n$$
6060

6161
$$\sum_{i=0}^n (n-i+1) = O(n^2)$$
6262

63-
![Quicksort Recursive](https://raw.githubusercontent.com/billryan/algorithm-exercise/master/shared-files/images/qsort1.png)
63+
![Quicksort Recursive](../../shared-files/images/qsort1.png)
6464

6565
## in-place - 原地快排
6666

6767
### one index for partition
6868

6969
先来看一种简单的 in-place 实现,仍然以`[6, 5, 3, 1, 8, 7, 2, 4]`为例,结合下图进行分析。以下标 $$l$$$$u$$ 表示数组待排序部分的下界(lower bound)和上界(upper bound),下标 $$m$$ 表示遍历到数组第 $$i$$ 个元素时当前 partition 的索引,基准元素为 $$t$$, 即图中的 target.
7070

71-
![Quick Sort one index for partition](https://raw.githubusercontent.com/billryan/algorithm-exercise/master/shared-files/images/qsort2.png)
71+
![Quick Sort one index for partition](../../shared-files/images/qsort2.png)
7272

7373
在遍历到第 $$i$$ 个元素时,$$x[i]$$ 有两种可能,第一种是 $$x[i] \geq t$$, $$i$$ 自增往后遍历;第二种是 $$x[i] < t$$, 此时需要将 $$x[i]$$ 置于前半部分,比较简单的实现为 `swap(x[++m], x[i])`. 直至 `i == u` 时划分阶段结束,分两截递归进行快排。既然说到递归,就不得不提递归的终止条件,容易想到递归的终止步为 `l >= u`, 即索引相等或者交叉时退出。使用 Python 的实现如下所示:
7474

@@ -164,7 +164,7 @@ public class Sort {
164164

165165
先来一张动图看看使用两个索引进行 partition 的过程。
166166

167-
![Quick Sort two index for partition](https://raw.githubusercontent.com/billryan/algorithm-exercise/master/shared-files/images/qsort3.gif)
167+
![Quick Sort two index for partition](../../shared-files/images/qsort3.gif)
168168

169169
1. 选中`3`作为基准
170170
2. `lo`指针指向元素`6`, `hi`指针指向`4`, 移动`lo`直至其指向的元素大于等于`3`, 移动`hi`直至其指向的元素小于`3`。找到后交换`lo``hi`指向的元素——交换元素`6``2`
@@ -293,5 +293,5 @@ Robert Sedgewick 在其网站上对 [Quicksort](http://algs4.cs.princeton.edu/23
293293
- [快速排序 - 维基百科,自由的百科全书](http://zh.wikipedia.org/wiki/%E5%BF%AB%E9%80%9F%E6%8E%92%E5%BA%8F)
294294
- [Quicksort | Robert Sedgewick](http://algs4.cs.princeton.edu/23quicksort/)
295295
- Programming Pearls Column 11 Sorting - 深入探讨了插入排序和快速排序
296-
- [Quicksort Analysis](https://raw.githubusercontent.com/billryan/algorithm-exercise/master/shared-files/docs/quicksort_analysis.pdf)
296+
- [Quicksort Analysis](../../shared-files/docs/quicksort_analysis.pdf)
297297
- [^programming_pearls]: Programming Pearls(第二版修订版) 一书中第11章排序中注明需要 $$n\log2n$$ 次比较,翻译有误?

zh-hans/basics_sorting/selection_sort.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
下图来源为 [File:Selection-Sort-Animation.gif - IB Computer Science](http://wiki.ibcsstudent.org/index.php?title=File:Selection-Sort-Animation.gif)
1616

17-
![Selection Sort](https://raw.githubusercontent.com/billryan/algorithm-exercise/master/shared-files/images/selection_sort.gif)
17+
![Selection Sort](../../shared-files/images/selection_sort.gif)
1818

1919
## Implementation
2020

0 commit comments

Comments
 (0)