Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a05b3bc

Browse files
committedDec 12, 2020
2 parents 849b8d0 + 1b0e27a commit a05b3bc

File tree

13 files changed

+468
-5
lines changed

13 files changed

+468
-5
lines changed
 

‎README.md

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ a set of rules that precisely define a sequence of operations.
6666
* `B` [Bit Manipulation](src/algorithms/math/bits) - set/get/update/clear bits, multiplication/division by two, make negative etc.
6767
* `B` [Factorial](src/algorithms/math/factorial)
6868
* `B` [Fibonacci Number](src/algorithms/math/fibonacci) - classic and closed-form versions
69+
* `B` [Prime Factors](src/algorithms/math/prime-factors) - finding prime factors and counting them using Hardy-Ramanujan's theorem
6970
* `B` [Primality Test](src/algorithms/math/primality-test) (trial division method)
7071
* `B` [Euclidean Algorithm](src/algorithms/math/euclidean-algorithm) - calculate the Greatest Common Divisor (GCD)
7172
* `B` [Least Common Multiple](src/algorithms/math/least-common-multiple) (LCM)

‎README.zh-CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ npm test -- 'LinkedList'
228228

229229
你可以在 `./src/playground/playground.js` 文件中操作数据结构与算法,并在 `./src/playground/__test__/playground.test.js` 中编写测试。
230230

231-
然后,只需运行以下命令来测试你的 Playground 是否按无误:
231+
然后,只需运行以下命令来测试你的 Playground 是否无误:
232232

233233
```
234234
npm test -- 'playground'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Prime Factors
2+
3+
**Prime number** is a whole number greater than `1` that **cannot** be made by multiplying other whole numbers. The first few prime numbers are: `2`, `3`, `5`, `7`, `11`, `13`, `17`, `19` and so on.
4+
5+
If we **can** make it by multiplying other whole numbers it is a **Composite Number**.
6+
7+
![Composite numbers](https://www.mathsisfun.com/numbers/images/prime-composite.svg)
8+
9+
_Image source: [Math is Fun](https://www.mathsisfun.com/prime-factorization.html)_
10+
11+
**Prime factors** are those [prime numbers](https://en.wikipedia.org/wiki/Prime_number) which multiply together to give the original number. For example `39` will have prime factors of `3` and `13` which are also prime numbers. Another example is `15` whose prime factors are `3` and `5`.
12+
13+
![Factors](https://www.mathsisfun.com/numbers/images/factor-2x3.svg)
14+
15+
_Image source: [Math is Fun](https://www.mathsisfun.com/prime-factorization.html)_
16+
17+
## Finding the prime factors and their count accurately
18+
19+
The approach is to keep on dividing the natural number `n` by indexes from `i = 2` to `i = n` (by prime indexes only). The value of `n` is being overridden by `(n / i)` on each iteration.
20+
21+
The time complexity till now is `O(n)` in the worst case scenario since the loop runs from index `i = 2` to `i = n`. This time complexity can be reduced from `O(n)` to `O(sqrt(n))`. The optimisation is achievable when loop runs from `i = 2` to `i = sqrt(n)`. Now, we go only till `O(sqrt(n))` because when `i` becomes greater than `sqrt(n)`, we have the confirmation that there is no index `i` left which can divide `n` completely other than `n` itself.
22+
23+
## Hardy-Ramanujan formula for approximate calculation of prime-factor count
24+
25+
In 1917, a theorem was formulated by G.H Hardy and Srinivasa Ramanujan which states that the normal order of the number `ω(n)` of distinct prime factors of a number `n` is `log(log(n))`.
26+
27+
Roughly speaking, this means that most numbers have about this number of distinct prime factors.
28+
29+
## References
30+
31+
- [Prime numbers on Math is Fun](https://www.mathsisfun.com/prime-factorization.html)
32+
- [Prime numbers on Wikipedia](https://en.wikipedia.org/wiki/Prime_number)
33+
- [Hardy–Ramanujan theorem on Wikipedia](https://en.wikipedia.org/wiki/Hardy%E2%80%93Ramanujan_theorem)
34+
- [Prime factorization of a number on Youtube](https://www.youtube.com/watch?v=6PDtgHhpCHo&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&index=82)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import {
2+
primeFactors,
3+
hardyRamanujan,
4+
} from '../primeFactors';
5+
6+
/**
7+
* Calculates the error between exact and approximate prime factor counts.
8+
* @param {number} exactCount
9+
* @param {number} approximateCount
10+
* @returns {number} - approximation error (percentage).
11+
*/
12+
function approximationError(exactCount, approximateCount) {
13+
return (Math.abs((exactCount - approximateCount) / exactCount) * 100);
14+
}
15+
16+
describe('primeFactors', () => {
17+
it('should find prime factors', () => {
18+
expect(primeFactors(1)).toEqual([]);
19+
expect(primeFactors(2)).toEqual([2]);
20+
expect(primeFactors(3)).toEqual([3]);
21+
expect(primeFactors(4)).toEqual([2, 2]);
22+
expect(primeFactors(14)).toEqual([2, 7]);
23+
expect(primeFactors(40)).toEqual([2, 2, 2, 5]);
24+
expect(primeFactors(54)).toEqual([2, 3, 3, 3]);
25+
expect(primeFactors(100)).toEqual([2, 2, 5, 5]);
26+
expect(primeFactors(156)).toEqual([2, 2, 3, 13]);
27+
expect(primeFactors(273)).toEqual([3, 7, 13]);
28+
expect(primeFactors(300)).toEqual([2, 2, 3, 5, 5]);
29+
expect(primeFactors(980)).toEqual([2, 2, 5, 7, 7]);
30+
expect(primeFactors(1000)).toEqual([2, 2, 2, 5, 5, 5]);
31+
expect(primeFactors(52734)).toEqual([2, 3, 11, 17, 47]);
32+
expect(primeFactors(343434)).toEqual([2, 3, 7, 13, 17, 37]);
33+
expect(primeFactors(456745)).toEqual([5, 167, 547]);
34+
expect(primeFactors(510510)).toEqual([2, 3, 5, 7, 11, 13, 17]);
35+
expect(primeFactors(8735463)).toEqual([3, 3, 11, 88237]);
36+
expect(primeFactors(873452453)).toEqual([149, 1637, 3581]);
37+
});
38+
39+
it('should give approximate prime factors count using Hardy-Ramanujan theorem', () => {
40+
expect(hardyRamanujan(2)).toBeCloseTo(-0.366, 2);
41+
expect(hardyRamanujan(4)).toBeCloseTo(0.326, 2);
42+
expect(hardyRamanujan(40)).toBeCloseTo(1.305, 2);
43+
expect(hardyRamanujan(156)).toBeCloseTo(1.6193, 2);
44+
expect(hardyRamanujan(980)).toBeCloseTo(1.929, 2);
45+
expect(hardyRamanujan(52734)).toBeCloseTo(2.386, 2);
46+
expect(hardyRamanujan(343434)).toBeCloseTo(2.545, 2);
47+
expect(hardyRamanujan(456745)).toBeCloseTo(2.567, 2);
48+
expect(hardyRamanujan(510510)).toBeCloseTo(2.575, 2);
49+
expect(hardyRamanujan(8735463)).toBeCloseTo(2.771, 2);
50+
expect(hardyRamanujan(873452453)).toBeCloseTo(3.024, 2);
51+
});
52+
53+
it('should give correct deviation between exact and approx counts', () => {
54+
expect(approximationError(primeFactors(2).length, hardyRamanujan(2)))
55+
.toBeCloseTo(136.651, 2);
56+
57+
expect(approximationError(primeFactors(4).length, hardyRamanujan(2)))
58+
.toBeCloseTo(118.325, 2);
59+
60+
expect(approximationError(primeFactors(40).length, hardyRamanujan(2)))
61+
.toBeCloseTo(109.162, 2);
62+
63+
expect(approximationError(primeFactors(156).length, hardyRamanujan(2)))
64+
.toBeCloseTo(109.162, 2);
65+
66+
expect(approximationError(primeFactors(980).length, hardyRamanujan(2)))
67+
.toBeCloseTo(107.330, 2);
68+
69+
expect(approximationError(primeFactors(52734).length, hardyRamanujan(52734)))
70+
.toBeCloseTo(52.274, 2);
71+
72+
expect(approximationError(primeFactors(343434).length, hardyRamanujan(343434)))
73+
.toBeCloseTo(57.578, 2);
74+
75+
expect(approximationError(primeFactors(456745).length, hardyRamanujan(456745)))
76+
.toBeCloseTo(14.420, 2);
77+
78+
expect(approximationError(primeFactors(510510).length, hardyRamanujan(510510)))
79+
.toBeCloseTo(63.201, 2);
80+
81+
expect(approximationError(primeFactors(8735463).length, hardyRamanujan(8735463)))
82+
.toBeCloseTo(30.712, 2);
83+
84+
expect(approximationError(primeFactors(873452453).length, hardyRamanujan(873452453)))
85+
.toBeCloseTo(0.823, 2);
86+
});
87+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* Finds prime factors of a number.
3+
*
4+
* @param {number} n - the number that is going to be split into prime factors.
5+
* @returns {number[]} - array of prime factors.
6+
*/
7+
export function primeFactors(n) {
8+
// Clone n to avoid function arguments override.
9+
let nn = n;
10+
11+
// Array that stores the all the prime factors.
12+
const factors = [];
13+
14+
// Running the loop till sqrt(n) instead of n to optimise time complexity from O(n) to O(sqrt(n)).
15+
for (let factor = 2; factor <= Math.sqrt(nn); factor += 1) {
16+
// Check that factor divides n without a reminder.
17+
while (nn % factor === 0) {
18+
// Overriding the value of n.
19+
nn /= factor;
20+
// Saving the factor.
21+
factors.push(factor);
22+
}
23+
}
24+
25+
// The ultimate reminder should be a last prime factor,
26+
// unless it is not 1 (since 1 is not a prime number).
27+
if (nn !== 1) {
28+
factors.push(nn);
29+
}
30+
31+
return factors;
32+
}
33+
34+
/**
35+
* Hardy-Ramanujan approximation of prime factors count.
36+
*
37+
* @param {number} n
38+
* @returns {number} - approximate number of prime factors.
39+
*/
40+
export function hardyRamanujan(n) {
41+
return Math.log(Math.log(n));
42+
}

‎src/algorithms/uncategorized/rain-terraces/bfRainTerraces.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default function bfRainTerraces(terraces) {
2525
if (terraceBoundaryLevel > terraces[terraceIndex]) {
2626
// Terrace will be able to store the water if the lowest of two left and right highest
2727
// terraces are still higher than the current one.
28-
waterAmount += Math.min(leftHighestLevel, rightHighestLevel) - terraces[terraceIndex];
28+
waterAmount += terraceBoundaryLevel - terraces[terraceIndex];
2929
}
3030
}
3131

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Doubly Linked List
2+
3+
_Read this in other languages:_
4+
[_Русский_](README.ru-RU.md),
5+
[_简体中文_](README.zh-CN.md),
6+
[_日本語_](README.ja-JP.md),
7+
[_Português_](README.pt-BR.md)
8+
9+
컴퓨터공학에서 **이중 연결 리스트**는 순차적으로 링크된 노드라는 레코드 세트로 구성된 링크된 데이터 구조입니다.
10+
각 노드에는 링크라고 하는 두 개의 필드가 있으며, 노드 순서에서 이전 노드와 다음 노드에 대한 참조를 가집니다.
11+
시작 및 종료 노드의 이전 및 다음 링크는 각각 리스트의 순회를 용이하게 하기 위해서 일종의 종결자 (일반적으로 센티넬노드 또는 null)를 나타냅니다.
12+
센티넬 노드가 하나만 있으면, 목록이 센티넬 노드를 통해서 원형으로 연결됩니다.
13+
동일한 데이터 항목으로 구성되어 있지만, 반대 순서로 두 개의 단일 연결 리스트로 개념화 할 수 있습니다.
14+
15+
![이중 연결 리스트](https://upload.wikimedia.org/wikipedia/commons/5/5e/Doubly-linked-list.svg)
16+
17+
두 개의 노드 링크를 사용하면 어느 방향으로든 리스트를 순회할 수 있습니다.
18+
이중 연결 리스트에서 노드를 추가하거나 제거하려면, 단일 연결 리스트에서 동일한 작업보다 더 많은 링크를 변경해야 하지만, 첫 번째 노드 이외의 노드인 경우 작업을 추적할 필요가 없으므로 작업이 더 단순해져 잠재적으로 더 효율적입니다.
19+
리스트 순회 중 이전 노드 또는 링크를 수정할 수 있도록 이전 노드를 찾기 위해 리스트를 순회할 필요가 없습니다.
20+
21+
## 기본 동작을 위한 Pseudocode
22+
23+
### 삽입
24+
25+
```text
26+
Add(value)
27+
Pre: value는 리스트에 추가하고자 하는 값
28+
Post: value는 목록의 끝에 배치됨
29+
n ← node(value)
30+
if head = ø
31+
head ← n
32+
tail ← n
33+
else
34+
n.previous ← tail
35+
tail.next ← n
36+
tail ← n
37+
end if
38+
end Add
39+
```
40+
41+
### 삭제
42+
43+
```text
44+
Remove(head, value)
45+
Pre: head는 리스트의 앞단에 위치
46+
value는 리스트에서 제거하고자 하는 값
47+
Post: value가 리스트에서 제거되면 true; 아니라면 false;
48+
if head = ø
49+
return false
50+
end if
51+
if value = head.value
52+
if head = tail
53+
head ← ø
54+
tail ← ø
55+
else
56+
head ← head.next
57+
head.previous ← ø
58+
end if
59+
return true
60+
end if
61+
n ← head.next
62+
while n = ø and value !== n.value
63+
n ← n.next
64+
end while
65+
if n = tail
66+
tail ← tail.previous
67+
tail.next ← ø
68+
return true
69+
else if n = ø
70+
n.previous.next ← n.next
71+
n.next.previous ← n.previous
72+
return true
73+
end if
74+
return false
75+
end Remove
76+
```
77+
78+
### 역순회
79+
80+
```text
81+
ReverseTraversal(tail)
82+
Pre: tail은 리스트에서 순회하고자 하는 노드
83+
Post: 리스트가 역순으로 순회됨
84+
n ← tail
85+
while n = ø
86+
yield n.value
87+
n ← n.previous
88+
end while
89+
end Reverse Traversal
90+
```
91+
92+
## 복잡도
93+
94+
## 시간 복잡도
95+
96+
| Access | Search | Insertion | Deletion |
97+
| :-------: | :-------: | :-------: | :-------: |
98+
| O(n) | O(n) | O(1) | O(n) |
99+
100+
### 공간 복잡도
101+
102+
O(n)
103+
104+
## 참고
105+
106+
- [Wikipedia](https://en.wikipedia.org/wiki/Doubly_linked_list)
107+
- [YouTube](https://www.youtube.com/watch?v=JdQeNxWCguQ&t=7s&index=72&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)

‎src/data-structures/doubly-linked-list/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ _Read this in other languages:_
55
[_简体中文_](README.zh-CN.md),
66
[_日本語_](README.ja-JP.md),
77
[_Português_](README.pt-BR.md)
8+
[_한국어_](README.ko-KR.md)
89

910
In computer science, a **doubly linked list** is a linked data structure that
1011
consists of a set of sequentially linked records called nodes. Each node contains
1112
two fields, called links, that are references to the previous and to the next
1213
node in the sequence of nodes. The beginning and ending nodes' previous and next
1314
links, respectively, point to some kind of terminator, typically a sentinel
14-
node or null, to facilitate traversal of the list. If there is only one
15+
node or null, to facilitate the traversal of the list. If there is only one
1516
sentinel node, then the list is circularly linked via the sentinel node. It can
1617
be conceptualized as two singly linked lists formed from the same data items,
1718
but in opposite sequential orders.

‎src/data-structures/hash-table/HashTable.js

+13
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,17 @@ export default class HashTable {
105105
getKeys() {
106106
return Object.keys(this.keys);
107107
}
108+
109+
/**
110+
* Gets the list of all the stored values in the hash table.
111+
*
112+
* @return {*[]}
113+
*/
114+
getValues() {
115+
return this.buckets.reduce((values, bucket) => {
116+
const bucketValues = bucket.toArray()
117+
.map((linkedListNode) => linkedListNode.value.value);
118+
return values.concat(bucketValues);
119+
}, []);
120+
}
108121
}

‎src/data-structures/hash-table/__test__/HashTable.test.js

+28
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,32 @@ describe('HashTable', () => {
8686
expect(hashTable.has('b')).toBe(true);
8787
expect(hashTable.has('x')).toBe(false);
8888
});
89+
90+
it('should get all the values', () => {
91+
const hashTable = new HashTable(3);
92+
93+
hashTable.set('a', 'alpha');
94+
hashTable.set('b', 'beta');
95+
hashTable.set('c', 'gamma');
96+
97+
expect(hashTable.getValues()).toEqual(['gamma', 'alpha', 'beta']);
98+
});
99+
100+
it('should get all the values from empty hash table', () => {
101+
const hashTable = new HashTable();
102+
expect(hashTable.getValues()).toEqual([]);
103+
});
104+
105+
it('should get all the values in case of hash collision', () => {
106+
const hashTable = new HashTable(3);
107+
108+
// Keys `ab` and `ba` in current implementation should result in one hash (one bucket).
109+
// We need to make sure that several items from one bucket will be serialized.
110+
hashTable.set('ab', 'one');
111+
hashTable.set('ba', 'two');
112+
113+
hashTable.set('ac', 'three');
114+
115+
expect(hashTable.getValues()).toEqual(['one', 'two', 'three']);
116+
});
89117
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
# 링크드 리스트
2+
3+
_Read this in other languages:_
4+
[_简体中文_](README.zh-CN.md),
5+
[_Русский_](README.ru-RU.md),
6+
[_日本語_](README.ja-JP.md),
7+
[_Português_](README.pt-BR.md)
8+
9+
컴퓨터과학에서, **링크드 리스트**는 데이터 요소의 선형 집합이며, 이 집합에서 논리적 저장 순서는 메모리의 물리적 저장 순서와 일치하지 않습니다. 그 대신, 각각의 원소들은 자기 자신 다음의 원소를 가리킵니다. **링크드 리스트**는 순서를 표현하는 노드들의 집합으로 이루어져 있습니다. 간단하게, 각각의 노드들은 데이터와 다음 순서의 노드를 가리키는 레퍼런스로 이루어져 있습니다. (링크라고 부릅니다.) 이 자료구조는 순회하는 동안 순서에 상관없이 효율적인 삽입이나 삭제가 가능합니다. 더 복잡한 변형은 추가적인 링크를 더해, 임의의 원소 참조로부터 효율적인 삽입과 삭제를 가능하게 합니다. 링크드 리스트의 단점은 접근 시간이 선형이라는 것이고, 병렬처리도 하지 못합니다. 임의 접근처럼 빠른 접근은 불가능합니다. 링크드 리스트에 비해 배열이 더 나은 캐시 지역성을 가지고 있습니다.
10+
11+
![링크드 리스트](https://upload.wikimedia.org/wikipedia/commons/6/6d/Singly-linked-list.svg)
12+
13+
## 기본 연산에 대한 수도코드
14+
15+
### 삽입
16+
17+
```text
18+
Add(value)
19+
Pre: 리스트에 추가할 값
20+
Post: 리스트의 맨 마지막에 있는 값
21+
n ← node(value)
22+
if head = ø
23+
head ← n
24+
tail ← n
25+
else
26+
tail.next ← n
27+
tail ← n
28+
end if
29+
end Add
30+
```
31+
32+
```text
33+
Prepend(value)
34+
Pre: 리스트에 추가할 값
35+
Post: 리스트의 맨 앞에 있는 값
36+
n ← node(value)
37+
n.next ← head
38+
head ← n
39+
if tail = ø
40+
tail ← n
41+
end
42+
end Prepend
43+
```
44+
45+
### 탐색
46+
47+
```text
48+
Contains(head, value)
49+
Pre: head는 리스트에서 맨 앞 노드
50+
value는 찾고자 하는 값
51+
Post: 항목이 링크드 리스트에 있으면 true;
52+
없으면 false
53+
n ← head
54+
while n != ø and n.value != value
55+
n ← n.next
56+
end while
57+
if n = ø
58+
return false
59+
end if
60+
return true
61+
end Contains
62+
```
63+
64+
### 삭제
65+
66+
```text
67+
Remove(head, value)
68+
Pre: head는 리스트에서 맨 앞 노드
69+
value는 삭제하고자 하는 값
70+
Post: 항목이 링크드 리스트에서 삭제되면 true;
71+
없으면 false
72+
if head = ø
73+
return false
74+
end if
75+
n ← head
76+
if n.value = value
77+
if head = tail
78+
head ← ø
79+
tail ← ø
80+
else
81+
head ← head.next
82+
end if
83+
return true
84+
end if
85+
while n.next != ø and n.next.value != value
86+
n ← n.next
87+
end while
88+
if n.next != ø
89+
if n.next = tail
90+
tail ← n
91+
end if
92+
n.next ← n.next.next
93+
return true
94+
end if
95+
return false
96+
end Remove
97+
```
98+
99+
### 순회
100+
101+
```text
102+
Traverse(head)
103+
Pre: head는 리스트에서 맨 앞 노드
104+
Post: 순회된 항목들
105+
n ← head
106+
while n != ø
107+
yield n.value
108+
n ← n.next
109+
end while
110+
end Traverse
111+
```
112+
113+
### 역순회
114+
115+
```text
116+
ReverseTraversal(head, tail)
117+
Pre: 같은 리스트에 들어 있는 맨 앞, 맨 뒤 노드
118+
Post: 역순회된 항목들
119+
if tail != ø
120+
curr ← tail
121+
while curr != head
122+
prev ← head
123+
while prev.next != curr
124+
prev ← prev.next
125+
end while
126+
yield curr.value
127+
curr ← prev
128+
end while
129+
yield curr.value
130+
end if
131+
end ReverseTraversal
132+
```
133+
134+
## 복잡도
135+
136+
### 시간 복잡도
137+
138+
| 접근 | 탐색 | 삽입 | 삭제 |
139+
| :---: | :---: | :---: | :---: |
140+
| O(n) | O(n) | O(1) | O(1) |
141+
142+
### 공간 복잡도
143+
144+
O(n)
145+
146+
## 참조
147+
148+
- [Wikipedia](https://en.wikipedia.org/wiki/Linked_list)
149+
- [YouTube](https://www.youtube.com/watch?v=njTh_OwMljA&index=2&t=1s&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)

‎src/data-structures/linked-list/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ _Read this in other languages:_
44
[_简体中文_](README.zh-CN.md),
55
[_Русский_](README.ru-RU.md),
66
[_日本語_](README.ja-JP.md),
7-
[_Português_](README.pt-BR.md)
7+
[_Português_](README.pt-BR.md),
8+
[_한국어_](README.ko-KR.md)
89

910
In computer science, a **linked list** is a linear collection
1011
of data elements, in which linear order is not given by

‎src/data-structures/trie/README.ru-RU.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
**Префиксное дерево** (также бор, луч, нагруженное или суффиксное дерево) в информатике - упорядоченная древовидная
44
структура данных, которая используется для хранения динамических множеств или ассоциативных массивов, где
5-
ключём обычно выступают строки. Дерево называется префиксным, потому что поиск осуществляется по префиксам.
5+
ключом обычно выступают строки. Дерево называется префиксным, потому что поиск осуществляется по префиксам.
66

77
В отличие от бинарного дерева, узлы не содержат ключи, соответствующие узлу. Представляет собой корневое дерево, каждое
88
ребро которого помечено каким-то символом так, что для любого узла все рёбра, соединяющие этот узел с его сыновьями,

0 commit comments

Comments
 (0)
Please sign in to comment.