Skip to content

Commit bc17e4e

Browse files
tiendqtrekhleb
authored andcommittedJun 12, 2018
docs: update correct Big-O chart (trekhleb#62)
1 parent 9de6bc7 commit bc17e4e

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed
 

‎README.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
[![Build Status](https://travis-ci.org/trekhleb/javascript-algorithms.svg?branch=master)](https://travis-ci.org/trekhleb/javascript-algorithms)
44
[![codecov](https://codecov.io/gh/trekhleb/javascript-algorithms/branch/master/graph/badge.svg)](https://codecov.io/gh/trekhleb/javascript-algorithms)
55

6-
This repository contains JavaScript based examples of many
6+
This repository contains JavaScript based examples of many
77
popular algorithms and data structures.
88

99
Each algorithm and data structure has its own separate README
1010
with related explanations and links for further reading (including ones
1111
to YouTube videos).
1212

13-
_Read this in other languages:_
13+
_Read this in other languages:_
1414
[简体中文](https://github.com/trekhleb/javascript-algorithms/blob/master/README.zh-CN.md),
1515
[繁體中文](https://github.com/trekhleb/javascript-algorithms/blob/master/README.zh-TW.md)
1616

1717
## Data Structures
1818

1919
A data structure is a particular way of organizing and storing data in a computer so that it can
20-
be accessed and modified efficiently. More precisely, a data structure is a collection of data
21-
values, the relationships among them, and the functions or operations that can be applied to
20+
be accessed and modified efficiently. More precisely, a data structure is a collection of data
21+
values, the relationships among them, and the functions or operations that can be applied to
2222
the data.
2323

2424
* [Linked List](https://github.com/trekhleb/javascript-algorithms/tree/master/src/data-structures/linked-list)
@@ -59,7 +59,7 @@ a set of rules that precisely define a sequence of operations.
5959
* [Permutations](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/permutations) (with and without repetitions)
6060
* [Combinations](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/combinations) (with and without repetitions)
6161
* [Fisher–Yates Shuffle](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/fisher-yates) - random permutation of a finite sequence
62-
* [Longest Common Subsequence](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/longest-common-subsequnce) (LCS)
62+
* [Longest Common Subsequence](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/longest-common-subsequnce) (LCS)
6363
* [Longest Increasing subsequence](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/longest-increasing-subsequence)
6464
* [Shortest Common Supersequence](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/shortest-common-supersequence) (SCS)
6565
* [Knapsack Problem](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/knapsack-problem) - "0/1" and "Unbound" ones
@@ -105,11 +105,11 @@ a set of rules that precisely define a sequence of operations.
105105
* [Tower of Hanoi](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/uncategorized/hanoi-tower)
106106
* [N-Queens Problem](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/uncategorized/n-queens)
107107
* [Knight's Tour](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/uncategorized/knight-tour)
108-
108+
109109
### Algorithms by Paradigm
110110

111-
An algorithmic paradigm is a generic method or approach which underlies the design of a class
112-
of algorithms. It is an abstraction higher than the notion of an algorithm, just as an
111+
An algorithmic paradigm is a generic method or approach which underlies the design of a class
112+
of algorithms. It is an abstraction higher than the notion of an algorithm, just as an
113113
algorithm is an abstraction higher than a computer program.
114114

115115
* **Brute Force** - look at all the possibilities and selects the best solution
@@ -142,7 +142,7 @@ algorithm is an abstraction higher than a computer program.
142142
* [Maximum Subarray](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/maximum-subarray)
143143
* [Bellman-Ford Algorithm](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/graph/bellman-ford) - finding shortest path to all graph vertices
144144
* **Backtracking** - similarly to brute force, try to generate all possible solutions, but each time you generate next solution you test
145-
if it satisfies all conditions, and only then continue generating subsequent solutions. Otherwise, backtrack, and go on a
145+
if it satisfies all conditions, and only then continue generating subsequent solutions. Otherwise, backtrack, and go on a
146146
different path of finding a solution. Normally the DFS traversal of state-space is being used.
147147
* [Hamiltonian Cycle](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/graph/hamiltonian-cycle) - Visit every vertex exactly once
148148
* [N-Queens Problem](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/uncategorized/n-queens)
@@ -188,13 +188,13 @@ npm test -- -t 'playground'
188188
[▶ Data Structures and Algorithms on YouTube](https://www.youtube.com/playlist?list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)
189189

190190
### Big O Notation
191-
191+
192192
Order of growth of algorithms specified in Big O notation.
193-
194-
![Big O graphs](https://github.com/trekhleb/javascript-algorithms/blob/master/assets/big-o-graph.png?raw=true)
193+
194+
![Big O graphs](./assets/big-o-graph.png)
195195

196196
Source: [Big O Cheat Sheet](http://bigocheatsheet.com/).
197-
197+
198198
Below is the list of some of the most used Big O notations and their performance comparisons against different sizes of the input data.
199199

200200
| Big O Notation | Computations for 10 elements | Computations for 100 elements | Computations for 1000 elements |
@@ -208,12 +208,12 @@ Below is the list of some of the most used Big O notations and their performance
208208
| **O(N!)** | 3628800 | 9.3e+157 | 4.02e+2567 |
209209

210210
### Data Structure Operations Complexity
211-
211+
212212
| Data Structure | Access | Search | Insertion | Deletion | Comments |
213-
| ----------------------- | :-------: | :-------: | :-------: | :-------: | :-------- |
213+
| ----------------------- | :-------: | :-------: | :-------: | :-------: | :-------- |
214214
| **Array** | 1 | n | n | n | |
215215
| **Stack** | n | n | 1 | 1 | |
216-
| **Queue** | n | n | 1 | 1 | |
216+
| **Queue** | n | n | 1 | 1 | |
217217
| **Linked List** | n | n | 1 | 1 | |
218218
| **Hash Table** | - | n | n | n | In case of perfect hash function costs would be O(1) |
219219
| **Binary Search Tree** | n | n | n | n | In case of balanced tree costs would be O(log(n)) |

‎README.zh-CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ npm test -- -t 'playground'
170170

171171
大O符号中指定的算法的增长顺序。
172172

173-
![Big O graphs](https://github.com/trekhleb/javascript-algorithms/blob/master/assets/big-o-graph.png?raw=true)
173+
![Big O graphs](./assets/big-o-graph.png)
174174

175175
源: [Big O Cheat Sheet](http://bigocheatsheet.com/).
176176

‎README.zh-TW.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ _Read this in other languages:_
4747
* [排列](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/permutations) (有/無重複)
4848
* [组合](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/combinations) (有/無重複)
4949
* [洗牌算法](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/fisher-yates) - 隨機置換一有限序列
50-
* [最長共同子序列](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/longest-common-subsequnce) (LCS)
50+
* [最長共同子序列](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/longest-common-subsequnce) (LCS)
5151
* [最長遞增子序列](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/longest-increasing-subsequence)
5252
* [Shortest Common Supersequence](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/shortest-common-supersequence) (SCS)
5353
* [背包問題](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/knapsack-problem) - "0/1" and "Unbound" ones
@@ -90,7 +90,7 @@ _Read this in other languages:_
9090
* [河內塔](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/uncategorized/hanoi-tower)
9191
* [N-皇后問題](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/uncategorized/n-queens)
9292
* [騎士走棋盤](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/uncategorized/knight-tour)
93-
93+
9494
### 演算法範型
9595

9696
演算法的範型是一個泛用方法或設計一類底層演算法的方式。它是一個比演算法的概念更高階的抽象化,就像是演算法是比電腦程式更高階的抽象化。
@@ -166,11 +166,11 @@ npm test -- -t 'playground'
166166
### 大 O 標記
167167

168168
特別用大 O 標記演算法增長度的排序。
169-
170-
![Big O 表](https://github.com/trekhleb/javascript-algorithms/blob/master/assets/big-o-graph.png?raw=true)
169+
170+
![Big O 表](./assets/big-o-graph.png)
171171

172172
資料來源: [Big O Cheat Sheet](http://bigocheatsheet.com/).
173-
173+
174174
下列列出幾個常用的 Big O 標記以及其不同大小資料量輸入後的運算效能比較。
175175

176176
| Big O 標記 | 10個資料量需花費的時間 | 100個資料量需花費的時間 | 1000個資料量需花費的時間 |
@@ -184,12 +184,12 @@ npm test -- -t 'playground'
184184
| **O(N!)** | 3628800 | 9.3e+157 | 4.02e+2567 |
185185

186186
### 資料結構運作複雜度
187-
187+
188188
| 資料結構 | 存取 | 搜尋 | 插入 | 刪除 |
189-
| ----------------------- | :-------: | :-------: | :-------: | :-------: |
189+
| ----------------------- | :-------: | :-------: | :-------: | :-------: |
190190
| **陣列** | 1 | n | n | n |
191191
| **堆疊** | n | n | 1 | 1 |
192-
| **貯列** | n | n | 1 | 1 |
192+
| **貯列** | n | n | 1 | 1 |
193193
| **鏈結串列** | n | n | 1 | 1 |
194194
| **雜湊表** | - | n | n | n |
195195
| **二元搜尋樹** | n | n | n | n |

‎assets/big-o-graph.png

-28.6 KB
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.