Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added ukr translations for bloom filter, Disjoint Set, Linked List #957

Merged
merged 2 commits into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions src/data-structures/bloom-filter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,39 @@

_Read this in other languages:_
[_Русский_](README.ru-RU.md),
[_Português_](README.pt-BR.md)
[_Português_](README.pt-BR.md),
[_Українська_](README.uk-UA.md)

A **bloom filter** is a space-efficient probabilistic
data structure designed to test whether an element
is present in a set. It is designed to be blazingly
A **bloom filter** is a space-efficient probabilistic
data structure designed to test whether an element
is present in a set. It is designed to be blazingly
fast and use minimal memory at the cost of potential
false positives. False positive matches are possible,
but false negatives are not – in other words, a query
returns either "possibly in set" or "definitely not in set".

Bloom proposed the technique for applications where the
Bloom proposed the technique for applications where the
amount of source data would require an impractically large
amount of memory if "conventional" error-free hashing
amount of memory if "conventional" error-free hashing
techniques were applied.

## Algorithm description

An empty Bloom filter is a bit array of `m` bits, all
An empty Bloom filter is a bit array of `m` bits, all
set to `0`. There must also be `k` different hash functions
defined, each of which maps or hashes some set element to
one of the `m` array positions, generating a uniform random
distribution. Typically, `k` is a constant, much smaller
than `m`, which is proportional to the number of elements
to be added; the precise choice of `k` and the constant of
proportionality of `m` are determined by the intended
defined, each of which maps or hashes some set element to
one of the `m` array positions, generating a uniform random
distribution. Typically, `k` is a constant, much smaller
than `m`, which is proportional to the number of elements
to be added; the precise choice of `k` and the constant of
proportionality of `m` are determined by the intended
false positive rate of the filter.

Here is an example of a Bloom filter, representing the
set `{x, y, z}`. The colored arrows show the positions
in the bit array that each set element is mapped to. The
element `w` is not in the set `{x, y, z}`, because it
hashes to one bit-array position containing `0`. For
Here is an example of a Bloom filter, representing the
set `{x, y, z}`. The colored arrows show the positions
in the bit array that each set element is mapped to. The
element `w` is not in the set `{x, y, z}`, because it
hashes to one bit-array position containing `0`. For
this figure, `m = 18` and `k = 3`.

![Bloom Filter](https://upload.wikimedia.org/wikipedia/commons/a/ac/Bloom_filter.svg)
Expand Down
54 changes: 54 additions & 0 deletions src/data-structures/bloom-filter/README.uk-UA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Фільтр Блума

**Фільтр Блума** - це просторово-ефективна ймовірна структура даних, створена для перевірки наявності елемента
у множині. Він спроектований неймовірно швидким за мінімального використання пам'яті ціною потенційних помилкових спрацьовувань.
Існує можливість отримати хибнопозитивне спрацьовування (елемента в безлічі немає, але структура даних повідомляє,
що він є), але не хибнонегативне. Іншими словами, черга повертає або "можливо в наборі", або "певно не
у наборі". Фільтр Блума може використовувати будь-який обсяг пам'яті, проте чим він більший, тим менша вірогідність помилкового
спрацьовування.

Блум запропонував цю техніку для застосування в областях, де кількість вихідних даних потребувала б непрактично багато
пам'яті, у разі застосування умовно безпомилкових технік хешування.

## Опис алгоритму

Порожній фільтр Блума представлений бітовим масивом з `m` бітів, всі біти якого обнулені. Має бути визначено `k`
незалежних хеш-функцій, що відображають кожен елемент множини в одну з `m` позицій у масиві, генеруючи однакове
випадковий розподіл. Зазвичай `k` задана константою, яка набагато менше `m` і пропорційна
кількості елементів, що додаються; точний вибір `k` та постійної пропорційності `m` визначаються рівнем хибних
спрацьовувань фільтра.

Ось приклад Блум фільтра, що представляє набір `{x, y, z}`. Кольорові стрілки показують позиції в бітовому масиві,
яким прив'язаний кожен елемент набору. Елемент `w` не в наборі `{x, y, z}`, тому що він прив'язаний до позиції в бітовому
масиві, що дорівнює `0`. Для цієї форми, `m = 18`, а `k = 3`.

Фільтр Блума є бітовий масив з `m` біт. Спочатку, коли структура даних зберігає порожню множину, всі
m біт обнулені. Користувач повинен визначити `k` незалежних хеш-функцій `h1`, …, `hk`,
що відображають кожен елемент в одну з m позицій бітового масиву досить рівномірним чином.

Для додавання елемента e необхідно записати одиниці на кожну з позицій `h1(e)`, …, `hk(e)`
бітового масиву.

Для перевірки приналежності елемента `e` до безлічі елементів, що зберігаються, необхідно перевірити стан бітів
`h1(e)`, …, `hk(e)`. Якщо хоча б один з них дорівнює нулю, елемент не може належати множині
(інакше при його додаванні всі ці біти були встановлені). Якщо вони рівні одиниці, то структура даних повідомляє,
що `е` належить безлічі. При цьому може виникнути дві ситуації: або елемент дійсно належить множині,
або всі ці біти виявилися встановлені випадково при додаванні інших елементів, що і є джерелом помилкових
спрацьовувань у цій структурі даних.

![Фільтр Блума](https://upload.wikimedia.org/wikipedia/commons/a/ac/Bloom_filter.svg)

## Застосування

Фільтр Блума може бути використаний для блогів. Якщо мета полягає в тому, щоб показати читачам лише ті статті,
які вони ще не бачили, фільтр блуму ідеальний. Він може містити значення, що хешуються, відповідні статті. Після
того, як користувач прочитав кілька статей, вони можуть бути поміщені у фільтр. Наступного разу, коли користувач
відвідає сайт, ці статті можуть бути вилучені з результатів за допомогою фільтра.

Деякі статті неминуче будуть відфільтровані помилково, але ціна прийнятна. Те, що користувач не побачить дещо
статей цілком прийнятно, беручи до уваги той факт, що йому завжди показуються інші нові статті при кожному
новому відвідуванні.

## Посилання

- [Wikipedia](https://uk.wikipedia.org/wiki/%D0%A4%D1%96%D0%BB%D1%8C%D1%82%D1%80_%D0%91%D0%BB%D1%83%D0%BC%D0%B0)
16 changes: 8 additions & 8 deletions src/data-structures/disjoint-set/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

_Read this in other languages:_
[_Русский_](README.ru-RU.md),
[_Português_](README.pt-BR.md)
[_Português_](README.pt-BR.md),
[_Українська_](README.uk-UA.md)


**Disjoint-set** data structure (also called a union–find data structure or merge–find set) is a data
structure that tracks a set of elements partitioned into a number of disjoint (non-overlapping) subsets.
It provides near-constant-time operations (bounded by the inverse Ackermann function) to *add new sets*,
to *merge existing sets*, and to *determine whether elements are in the same set*.
**Disjoint-set** data structure (also called a union–find data structure or merge–find set) is a data
structure that tracks a set of elements partitioned into a number of disjoint (non-overlapping) subsets.
It provides near-constant-time operations (bounded by the inverse Ackermann function) to _add new sets_,
to _merge existing sets_, and to _determine whether elements are in the same set_.
In addition to many other uses (see the Applications section), disjoint-sets play a key role in Kruskal's algorithm for finding the minimum spanning tree of a graph.

![disjoint set](https://upload.wikimedia.org/wikipedia/commons/6/67/Dsu_disjoint_sets_init.svg)

*MakeSet* creates 8 singletons.
_MakeSet_ creates 8 singletons.

![disjoint set](https://upload.wikimedia.org/wikipedia/commons/a/ac/Dsu_disjoint_sets_final.svg)

After some operations of *Union*, some sets are grouped together.
After some operations of _Union_, some sets are grouped together.

## References

Expand Down
22 changes: 22 additions & 0 deletions src/data-structures/disjoint-set/README.uk-UA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Система неперетинних множин

**Система неперетинних множин** це структура даних (також звана структурою даної пошуку перетину або
безліччю пошуку злиття), яка управляє безліччю елементів, розбитих на кілька підмножин, що не перетинаються.
Вона надає близько-константний час виконання операцій (обмежений зворотною функцією Акерманна) за додаванням
нових множин, *злиття існуючих множин і *випередження, чи відносяться елементи до одного і того ж безлічі.

Застосовується для зберігання компонентів зв'язності в графах, зокрема, алгоритму Фарбала необхідна подібна структура
даних для ефективної реалізації.

Основні операції:

- _MakeSet(x)_ - створює одноелементне безліч {x},
- _Find(x)_ - повертає ідентифікатор множини, що містить елемент x,
- _Union(x,y)_ - об'єднання множин, що містять x та y.

Після деяких операцій _об'єднання_, деякі множини зібрані разом

## Посилання

- [СНМ на Wikipedia](https://uk.wikipedia.org/wiki/%D0%A1%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0_%D0%BD%D0%B5%D0%BF%D0%B5%D1%80%D0%B5%D1%82%D0%B8%D0%BD%D0%BD%D0%B8%D1%85_%D0%BC%D0%BD%D0%BE%D0%B6%D0%B8%D0%BD)
- [СНМ на YouTube](https://www.youtube.com/watch?v=5XwRPwLnK6I)
9 changes: 5 additions & 4 deletions src/data-structures/doubly-linked-list/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ _Read this in other languages:_
[_Português_](README.pt-BR.md),
[_한국어_](README.ko-KR.md),
[_Español_](README.es-ES.md),
[_Українська_](README.uk-UA.md)

In computer science, a **doubly linked list** is a linked data structure that
consists of a set of sequentially linked records called nodes. Each node contains
Expand All @@ -20,7 +21,7 @@ but in opposite sequential orders.

![Doubly Linked List](./images/doubly-linked-list.jpeg)

*Made with [okso.app](https://okso.app)*
_Made with [okso.app](https://okso.app)_

The two node links allow traversal of the list in either direction. While adding
or removing a node in a doubly linked list requires changing more links than the
Expand Down Expand Up @@ -104,9 +105,9 @@ end Reverse Traversal

## Time Complexity

| Access | Search | Insertion | Deletion |
| :-------: | :-------: | :-------: | :-------: |
| O(n) | O(n) | O(1) | O(n) |
| Access | Search | Insertion | Deletion |
| :----: | :----: | :-------: | :------: |
| O(n) | O(n) | O(1) | O(n) |

### Space Complexity

Expand Down
109 changes: 109 additions & 0 deletions src/data-structures/doubly-linked-list/README.uk-UA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Двобічно зв'язаний список

**Двобічно зв'язаний список** — зв'язкова структура даних в інформатиці, що складається з набору
послідовно пов'язаних записів, званих вузлами. Кожен вузол містить два поля,
званих посиланнями, які вказують на попередній і наступний елементи
послідовність вузлів. Посилання на попередній елемент кореневого вузла та посилання на
Наступний елемент останнього вузла вказують на деякого роду переривник, зазвичай
сторожовий вузол або null для полегшення обходу списку. Якщо у списку лише один
сторожовий вузол, тоді перелік циклічно пов'язаний через нього.
Двобічно зв'язаний список можна уявити, як два зв'язкові списки, які утворені з
одних і тих самих даних, але розташованих у протилежному порядку.

![Двобічно зв'язаний список](./images/doubly-linked-list.jpeg)

_Made with [okso.app](https://okso.app)_

Два посилання дозволяють обходити список в обох напрямках. Додавання та
видалення вузла у двозв'язному списку вимагає зміни більшої кількості посилань,
ніж аналогічні операції у зв'язковому списку. Однак дані операції простіше та потенційно
більш ефективні (для некореневих вузлів) – при обході не потрібно стежити за попереднім
вузлом або повторно обходити список у пошуку попереднього вузла, плюс його посилання
може бути змінено.

## Псевдокод основних операцій

### Вставка

```text
Add(value)
Pre: value - значення, що додається
Post: value поміщено в кінець списку
n ← node(value)
if head = ø
head ← n
tail ← n
else
n.previous ← tail
tail.next ← n
tail ← n
end if
end Add
```

### Видалення

```text
Remove(head, value)
Pre: head - перший вузол у списку
value - значення, яке слід видалити
Post: true - value видалено зі списку, інакше false
if head = ø
return false
end if
if value = head.value
if head = tail
head ← ø
tail ← ø
else
head ← head.next
head.previous ← ø
end if
return true
end if
n ← head.next
while n = ø and value = n.value
n ← n.next
end while
if n = tail
tail ← tail.previous
tail.next ← ø
return true
else if n = ø
n.previous.next ← n.next
n.next.previous ← n.previous
return true
end if
return false
end Remove
```

### Зворотний обхід

```text
ReverseTraversal(tail)
Pre: tail - кінцевий елемент обхідного списку
Post: елементи списку пройдено у зворотному порядку
n ← tail
while n = ø
yield n.value
n ← n.previous
end while
end Reverse Traversal
```

## Складність

## Часова складність

| Читання | Пошук | Вставка | Видалення |
| :-----: | :---: | :-----: | :-------: |
| O(n) | O(n) | O(1) | O(n) |

### Просторова складність

O(n)

## Посилання

- [Wikipedia](https://uk.wikipedia.org/wiki/%D0%94%D0%B2%D0%BE%D0%B1%D1%96%D1%87%D0%BD%D0%BE_%D0%B7%D0%B2%27%D1%8F%D0%B7%D0%B0%D0%BD%D0%B8%D0%B9_%D1%81%D0%BF%D0%B8%D1%81%D0%BE%D0%BA#:~:text=%D0%94%D0%B2%D0%BE%D0%B1%D1%96%D1%87%D0%BD%D0%BE%20%D0%B7%D0%B2'%D1%8F%D0%B7%D0%B0%D0%BD%D0%B8%D0%B9%20%D1%81%D0%BF%D0%B8%D1%81%D0%BE%D0%BA%20%E2%80%94%20%D0%B2%D0%B8%D0%B4,%D0%BD%D0%B0%20%D0%BF%D0%BE%D0%B4%D0%B0%D0%BB%D1%8C%D1%88%D0%B8%D0%B9%20%D0%B2%D1%83%D0%B7%D0%BE%D0%BB%20%D1%83%20%D1%81%D0%BF%D0%B8%D1%81%D0%BA%D1%83.)