| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9de6bc7 commit bc17e4e
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,22 +3,22 @@ | |||
| 3 | 3 | [](https://travis-ci.org/trekhleb/javascript-algorithms) | |
| 4 | 4 | [](https://codecov.io/gh/trekhleb/javascript-algorithms) | |
| 5 | 5 | ||
| 6 | - This repository contains JavaScript based examples of many | ||
| 6 | + This repository contains JavaScript based examples of many | ||
| 7 | 7 | popular algorithms and data structures. | |
| 8 | 8 | ||
| 9 | 9 | Each algorithm and data structure has its own separate README | |
| 10 | 10 | with related explanations and links for further reading (including ones | |
| 11 | 11 | to YouTube videos). | |
| 12 | 12 | ||
| 13 | - _Read this in other languages:_ | ||
| 13 | + _Read this in other languages:_ | ||
| 14 | 14 | [简体中文](https://github.com/trekhleb/javascript-algorithms/blob/master/README.zh-CN.md), | |
| 15 | 15 | [繁體中文](https://github.com/trekhleb/javascript-algorithms/blob/master/README.zh-TW.md) | |
| 16 | 16 | ||
| 17 | 17 | ## Data Structures | |
| 18 | 18 | ||
| 19 | 19 | 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 | ||
| 22 | 22 | the data. | |
| 23 | 23 | ||
| 24 | 24 | * [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. | |||
| 59 | 59 | * [Permutations](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/permutations) (with and without repetitions) | |
| 60 | 60 | * [Combinations](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/combinations) (with and without repetitions) | |
| 61 | 61 | * [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) | ||
| 63 | 63 | * [Longest Increasing subsequence](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/longest-increasing-subsequence) | |
| 64 | 64 | * [Shortest Common Supersequence](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/shortest-common-supersequence) (SCS) | |
| 65 | 65 | * [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. | |||
| 105 | 105 | * [Tower of Hanoi](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/uncategorized/hanoi-tower) | |
| 106 | 106 | * [N-Queens Problem](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/uncategorized/n-queens) | |
| 107 | 107 | * [Knight's Tour](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/uncategorized/knight-tour) | |
| 108 | - | ||
| 108 | + | ||
| 109 | 109 | ### Algorithms by Paradigm | |
| 110 | 110 | ||
| 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 | ||
| 113 | 113 | algorithm is an abstraction higher than a computer program. | |
| 114 | 114 | ||
| 115 | 115 | * **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. | |||
| 142 | 142 | * [Maximum Subarray](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/maximum-subarray) | |
| 143 | 143 | * [Bellman-Ford Algorithm](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/graph/bellman-ford) - finding shortest path to all graph vertices | |
| 144 | 144 | * **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 | ||
| 146 | 146 | different path of finding a solution. Normally the DFS traversal of state-space is being used. | |
| 147 | 147 | * [Hamiltonian Cycle](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/graph/hamiltonian-cycle) - Visit every vertex exactly once | |
| 148 | 148 | * [N-Queens Problem](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/uncategorized/n-queens) | |
@@ -188,13 +188,13 @@ npm test -- -t 'playground' | |||
| 188 | 188 | [▶ Data Structures and Algorithms on YouTube](https://www.youtube.com/playlist?list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) | |
| 189 | 189 | ||
| 190 | 190 | ### Big O Notation | |
| 191 | - | ||
| 191 | + | ||
| 192 | 192 | Order of growth of algorithms specified in Big O notation. | |
| 193 | - | ||
| 194 | -  | ||
| 193 | + | ||
| 194 | +  | ||
| 195 | 195 | ||
| 196 | 196 | Source: [Big O Cheat Sheet](http://bigocheatsheet.com/). | |
| 197 | - | ||
| 197 | + | ||
| 198 | 198 | Below is the list of some of the most used Big O notations and their performance comparisons against different sizes of the input data. | |
| 199 | 199 | ||
| 200 | 200 | | 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 | |||
| 208 | 208 | | **O(N!)** | 3628800 | 9.3e+157 | 4.02e+2567 | | |
| 209 | 209 | ||
| 210 | 210 | ### Data Structure Operations Complexity | |
| 211 | - | ||
| 211 | + | ||
| 212 | 212 | | Data Structure | Access | Search | Insertion | Deletion | Comments | | |
| 213 | - | ----------------------- | :-------: | :-------: | :-------: | :-------: | :-------- | | ||
| 213 | + | ----------------------- | :-------: | :-------: | :-------: | :-------: | :-------- | | ||
| 214 | 214 | | **Array** | 1 | n | n | n | | | |
| 215 | 215 | | **Stack** | n | n | 1 | 1 | | | |
| 216 | - | **Queue** | n | n | 1 | 1 | | | ||
| 216 | + | **Queue** | n | n | 1 | 1 | | | ||
| 217 | 217 | | **Linked List** | n | n | 1 | 1 | | | |
| 218 | 218 | | **Hash Table** | - | n | n | n | In case of perfect hash function costs would be O(1) | | |
| 219 | 219 | | **Binary Search Tree** | n | n | n | n | In case of balanced tree costs would be O(log(n)) | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -170,7 +170,7 @@ npm test -- -t 'playground' | |||
| 170 | 170 | ||
| 171 | 171 | 大O符号中指定的算法的增长顺序。 | |
| 172 | 172 | ||
| 173 | -  | ||
| 173 | +  | ||
| 174 | 174 | ||
| 175 | 175 | 源: [Big O Cheat Sheet](http://bigocheatsheet.com/). | |
| 176 | 176 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,7 +47,7 @@ _Read this in other languages:_ | |||
| 47 | 47 | * [排列](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/permutations) (有/無重複) | |
| 48 | 48 | * [组合](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/combinations) (有/無重複) | |
| 49 | 49 | * [洗牌算法](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) | ||
| 51 | 51 | * [最長遞增子序列](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/longest-increasing-subsequence) | |
| 52 | 52 | * [Shortest Common Supersequence](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/sets/shortest-common-supersequence) (SCS) | |
| 53 | 53 | * [背包問題](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:_ | |||
| 90 | 90 | * [河內塔](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/uncategorized/hanoi-tower) | |
| 91 | 91 | * [N-皇后問題](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/uncategorized/n-queens) | |
| 92 | 92 | * [騎士走棋盤](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/uncategorized/knight-tour) | |
| 93 | - | ||
| 93 | + | ||
| 94 | 94 | ### 演算法範型 | |
| 95 | 95 | ||
| 96 | 96 | 演算法的範型是一個泛用方法或設計一類底層演算法的方式。它是一個比演算法的概念更高階的抽象化,就像是演算法是比電腦程式更高階的抽象化。 | |
@@ -166,11 +166,11 @@ npm test -- -t 'playground' | |||
| 166 | 166 | ### 大 O 標記 | |
| 167 | 167 | ||
| 168 | 168 | 特別用大 O 標記演算法增長度的排序。 | |
| 169 | - | ||
| 170 | -  | ||
| 169 | + | ||
| 170 | +  | ||
| 171 | 171 | ||
| 172 | 172 | 資料來源: [Big O Cheat Sheet](http://bigocheatsheet.com/). | |
| 173 | - | ||
| 173 | + | ||
| 174 | 174 | 下列列出幾個常用的 Big O 標記以及其不同大小資料量輸入後的運算效能比較。 | |
| 175 | 175 | ||
| 176 | 176 | | Big O 標記 | 10個資料量需花費的時間 | 100個資料量需花費的時間 | 1000個資料量需花費的時間 | | |
@@ -184,12 +184,12 @@ npm test -- -t 'playground' | |||
| 184 | 184 | | **O(N!)** | 3628800 | 9.3e+157 | 4.02e+2567 | | |
| 185 | 185 | ||
| 186 | 186 | ### 資料結構運作複雜度 | |
| 187 | - | ||
| 187 | + | ||
| 188 | 188 | | 資料結構 | 存取 | 搜尋 | 插入 | 刪除 | | |
| 189 | - | ----------------------- | :-------: | :-------: | :-------: | :-------: | | ||
| 189 | + | ----------------------- | :-------: | :-------: | :-------: | :-------: | | ||
| 190 | 190 | | **陣列** | 1 | n | n | n | | |
| 191 | 191 | | **堆疊** | n | n | 1 | 1 | | |
| 192 | - | **貯列** | n | n | 1 | 1 | | ||
| 192 | + | **貯列** | n | n | 1 | 1 | | ||
| 193 | 193 | | **鏈結串列** | n | n | 1 | 1 | | |
| 194 | 194 | | **雜湊表** | - | n | n | n | | |
| 195 | 195 | | **二元搜尋樹** | n | n | n | n | | |
| Back | FazBrowse Home | New Git URL |
0 commit comments