Compare commits

..

12 Commits

Author SHA1 Message Date
trainer2001
67dd84b717
Merge 2b4f12622a into ca3d16dcce 2024-07-17 10:41:24 +09:00
Vlad Sosnov
ca3d16dcce
Update README.uk-UA.md (#991)
Co-authored-by: Oleksii Trekhleb <3000285+trekhleb@users.noreply.github.com>
2024-07-13 21:28:34 +02:00
Vicente Gutiérrez
e7f30a7bf7
Fix typos README.es-ES for linked list (#850) 2024-07-13 21:28:02 +02:00
Enzo
471e6d0791
Add es-ES translation to search/binary-search (#893) 2024-07-13 21:27:09 +02:00
Alaz Tetik
351a63a59f
Update README.md by correcting Turkish lang name (#904)
Co-authored-by: Oleksii Trekhleb <3000285+trekhleb@users.noreply.github.com>
2024-07-13 21:25:58 +02:00
Nikita Gurskiy
0e2b2574f8
update the ES README a lenguage correction (#952) 2024-07-13 21:23:02 +02:00
Youssef Rabei
0c054f782a
Update README.ar-AR.md (#959)
Co-authored-by: Oleksii Trekhleb <3000285+trekhleb@users.noreply.github.com>
2024-07-13 21:22:10 +02:00
JungHyunLah
6509304ff6
update LRU Cache translation for ko-KR (#987)
* feat: LRU cache translation in ko-KR

* chore: add readInAnotherLan for ko-KR

---------

Co-authored-by: Oleksii Trekhleb <3000285+trekhleb@users.noreply.github.com>
2024-07-13 21:20:23 +02:00
Stanislav Dolgachov
09afeb58d8
Update .eslintrc, improve UK translation for LinkedList (#1128)
* Add ignore patterns to eslint config

* Improve UK translation for LinkedList

---------

Co-authored-by: Oleksii Trekhleb <3000285+trekhleb@users.noreply.github.com>
2024-07-13 21:13:11 +02:00
Qudratillo
d7a41a6461
feat: added uzbek language (#1082)
Co-authored-by: Oleksii Trekhleb <3000285+trekhleb@users.noreply.github.com>
2024-07-13 21:09:06 +02:00
Mahdi Azarboon
9046d80bdb
Update README.md (#1141)
Before diving into any of the data structures, readers should be reminded of two fundamental laws in software architecture:

1.Everything is a trade-ff
2."Why is more important than the how"

So, readers face the nuances and reality of these data structures from the beginning. These two laws are coined by two thought leaders in software architecture: Mark Richards and Neal Ford. They have explained these two laws in various conference talks and books. For example, here you can read about these two laws here:

https://www.infoq.com/podcasts/software-architecture-hard-parts/


Also, here is a book for reference:
https://a.co/d/fKOodW9

Co-authored-by: Oleksii Trekhleb <3000285+trekhleb@users.noreply.github.com>
2024-07-13 20:58:45 +02:00
Alexander Cyon
e5b5944c68
Fix four typos (#1139) 2024-07-13 20:56:39 +02:00
30 changed files with 517 additions and 57 deletions

View File

@ -12,6 +12,7 @@
"arrow-body-style": "off", "arrow-body-style": "off",
"no-loop-func": "off" "no-loop-func": "off"
}, },
"ignorePatterns": ["*.md", "*.png", "*.jpeg", "*.jpg"],
"settings": { "settings": {
"react": { "react": {
"version": "18.2.0" "version": "18.2.0"

View File

@ -3,7 +3,7 @@
[![Build Status](https://travis-ci.org/trekhleb/javascript-algorithms.svg?branch=master)](https://travis-ci.org/trekhleb/javascript-algorithms) [![Build Status](https://travis-ci.org/trekhleb/javascript-algorithms.svg?branch=master)](https://travis-ci.org/trekhleb/javascript-algorithms)
[![codecov](https://codecov.io/gh/trekhleb/javascript-algorithms/branch/master/graph/badge.svg)](https://codecov.io/gh/trekhleb/javascript-algorithms) [![codecov](https://codecov.io/gh/trekhleb/javascript-algorithms/branch/master/graph/badge.svg)](https://codecov.io/gh/trekhleb/javascript-algorithms)
تحتوي هذا مقالة على أمثلة عديدة تستند إلى الخوارزميات الشائعة وهياكل البيانات في الجافا سكريبت. تحتوي هذه المقالة على أمثلة عديدة تستند إلى الخوارزميات الشائعة وهياكل البيانات في الجافا سكريبت.
كل خوارزمية وهياكل البيانات لها برنامج README منفصل خاص بها كل خوارزمية وهياكل البيانات لها برنامج README منفصل خاص بها
مع التفسيرات والروابط ذات الصلة لمزيد من القراءة (بما في ذلك تلك مع التفسيرات والروابط ذات الصلة لمزيد من القراءة (بما في ذلك تلك
@ -23,7 +23,8 @@ _اقرأ هذا في لغات أخرى:_
[_Türk_](README.tr-TR.md), [_Türk_](README.tr-TR.md),
[_Italiana_](README.it-IT.md), [_Italiana_](README.it-IT.md),
[_Tiếng Việt_](README.vi-VN.md), [_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md) [_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
☝ ملاحضة هذا المشروع مخصص للاستخدام لأغراض التعلم والبحث ☝ ملاحضة هذا المشروع مخصص للاستخدام لأغراض التعلم والبحث
فقط ، و ** ليست ** معدة للاستخدام في **الإنتاج** فقط ، و ** ليست ** معدة للاستخدام في **الإنتاج**

View File

@ -24,7 +24,8 @@ _Lies dies in anderen Sprachen:_
[_Italiana_](README.it-IT.md), [_Italiana_](README.it-IT.md),
[_Bahasa Indonesia_](README.id-ID.md), [_Bahasa Indonesia_](README.id-ID.md),
[_Українська_](README.uk-UA.md), [_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md) [_Arabic_](README.ar-AR.md),
[_Uzbek_](README.uz-UZ.md)
_☝ Beachte, dass dieses Projekt nur für Lern- und Forschungszwecke gedacht ist und **nicht** für den produktiven Einsatz verwendet werden soll_ _☝ Beachte, dass dieses Projekt nur für Lern- und Forschungszwecke gedacht ist und **nicht** für den produktiven Einsatz verwendet werden soll_

View File

@ -25,7 +25,8 @@ _Léelo en otros idiomas:_
[_Українська_](README.uk-UA.md), [_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md), [_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md), [_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md) [_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
*☝ Nótese que este proyecto está pensado con fines de aprendizaje e investigación, *☝ Nótese que este proyecto está pensado con fines de aprendizaje e investigación,
y **no** para ser usado en producción.* y **no** para ser usado en producción.*
@ -69,7 +70,7 @@ definen con precisión una secuencia de operaciones.
* **Matemáticas** * **Matemáticas**
* `P` [Manipulación de bits](src/algorithms/math/bits) - asignar/obtener/actualizar/limpiar bits, multiplicación/división por dos, hacer negativo, etc. * `P` [Manipulación de bits](src/algorithms/math/bits) - asignar/obtener/actualizar/limpiar bits, multiplicación/división por dos, hacer negativo, etc.
* `P` [Factorial](src/algorithms/math/factorial) * `P` [Factorial](src/algorithms/math/factorial)
* `P` [Número de Fibonacci](src/algorithms/math/fibonacci) * `P` [Sucesión de Fibonacci](src/algorithms/math/fibonacci)
* `P` [Prueba de primalidad](src/algorithms/math/primality-test) (método de división de prueba) * `P` [Prueba de primalidad](src/algorithms/math/primality-test) (método de división de prueba)
* `P` [Algoritmo de Euclides](src/algorithms/math/euclidean-algorithm) - calcular el Máximo común divisor (MCD) * `P` [Algoritmo de Euclides](src/algorithms/math/euclidean-algorithm) - calcular el Máximo común divisor (MCD)
* `P` [Mínimo común múltiplo](src/algorithms/math/least-common-multiple) (MCM) * `P` [Mínimo común múltiplo](src/algorithms/math/least-common-multiple) (MCM)

View File

@ -26,7 +26,8 @@ _Lisez ceci dans d'autres langues:_
[_Українська_](README.uk-UA.md), [_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md), [_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md), [_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md) [_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
## Data Structures ## Data Structures

View File

@ -23,7 +23,8 @@ _Baca ini dalam bahasa yang lain:_
[_Українська_](README.uk-UA.md), [_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md), [_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md), [_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md) [_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
_☝ Perhatikan bahwa proyek ini hanya dimaksudkan untuk tujuan pembelajaran dan riset, dan **tidak** dimaksudkan untuk digunakan sebagai produksi._ _☝ Perhatikan bahwa proyek ini hanya dimaksudkan untuk tujuan pembelajaran dan riset, dan **tidak** dimaksudkan untuk digunakan sebagai produksi._

View File

@ -22,7 +22,8 @@ _Leggilo in altre lingue:_
[_Українська_](README.uk-UA.md), [_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md), [_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md), [_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md) [_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
*☝ Si noti che questo progetto è destinato ad essere utilizzato solo per l'apprendimento e la ricerca e non è destinato ad essere utilizzato per il commercio.* *☝ Si noti che questo progetto è destinato ad essere utilizzato solo per l'apprendimento e la ricerca e non è destinato ad essere utilizzato per il commercio.*

View File

@ -25,7 +25,8 @@ _Read this in other languages:_
[_Українська_](README.uk-UA.md), [_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md), [_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md), [_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md) [_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
## データ構造 ## データ構造

View File

@ -24,7 +24,8 @@ _Read this in other languages:_
[_Українська_](README.uk-UA.md), [_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md), [_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md), [_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md) [_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
## 자료 구조 ## 자료 구조

View File

@ -36,7 +36,8 @@ _Read this in other languages:_
[_Українська_](README.uk-UA.md), [_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md), [_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md), [_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md) [_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
*☝ Note that this project is meant to be used for learning and researching purposes *☝ Note that this project is meant to be used for learning and researching purposes
only, and it is **not** meant to be used for production.* only, and it is **not** meant to be used for production.*
@ -48,6 +49,8 @@ be accessed and modified efficiently. More precisely, a data structure is a coll
values, the relationships among them, and the functions or operations that can be applied to values, the relationships among them, and the functions or operations that can be applied to
the data. the data.
Remember that each data has its own trade-offs. And you need to pay attention more to why you're choosing a certain data structure than to how to implement it.
`B` - Beginner, `A` - Advanced `B` - Beginner, `A` - Advanced
* `B` [Linked List](src/data-structures/linked-list) * `B` [Linked List](src/data-structures/linked-list)

View File

@ -26,7 +26,8 @@ _Read this in other languages:_
[_Українська_](README.uk-UA.md), [_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md), [_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md), [_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md) [_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
## Struktury Danych ## Struktury Danych

View File

@ -26,7 +26,8 @@ _Leia isto em outros idiomas:_
[_Українська_](README.uk-UA.md), [_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md), [_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md), [_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md) [_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
## Estrutura de Dados ## Estrutura de Dados

View File

@ -23,7 +23,8 @@ _Читать на других языках:_
[_Українська_](README.uk-UA.md), [_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md), [_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md), [_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md) [_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
*☝ Замечание: этот репозиторий предназначен для учебно-исследовательских целей (**не** для использования в продакшн-системах).* *☝ Замечание: этот репозиторий предназначен для учебно-исследовательских целей (**не** для использования в продакшн-системах).*

View File

@ -23,7 +23,8 @@ _Read this in other languages:_
[_Українська_](README.uk-UA.md), [_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md), [_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md), [_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md) [_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
*☝ Not, bu proje araştırma ve öğrenme amacı ile yapılmış *☝ Not, bu proje araştırma ve öğrenme amacı ile yapılmış
olup üretim için **yapılmamıştır**.* olup üretim için **yapılmamıştır**.*

View File

@ -23,7 +23,8 @@ _Вивчення матеріалу на інших мовах:_
[_Bahasa Indonesia_](README.id-ID.md), [_Bahasa Indonesia_](README.id-ID.md),
[_Arabic_](README.ar-AR.md), [_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md), [_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md) [_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
*☝ Зверніть увагу! Даний проект призначений лише для навчальних та дослідницьких цілей, і він **не** призначений для виробництва (продакшн).* *☝ Зверніть увагу! Даний проект призначений лише для навчальних та дослідницьких цілей, і він **не** призначений для виробництва (продакшн).*

358
README.uz-UZ.md Normal file
View File

@ -0,0 +1,358 @@
# JavaScript algoritmlari va ma'lumotlar tuzilmalari
[![CI](https://github.com/trekhleb/javascript-algorithms/workflows/CI/badge.svg)](https://github.com/trekhleb/javascript-algorithms/actions?query=workflow%3ACI+branch%3Amaster)
[![codecov](https://codecov.io/gh/trekhleb/javascript-algorithms/branch/master/graph/badge.svg)](https://codecov.io/gh/trekhleb/javascript-algorithms)
![repo size](https://img.shields.io/github/repo-size/trekhleb/javascript-algorithms.svg)
Bu repozitoriyada JavaScript-ga asoslangan ko'plab mashhur algoritmlar
va ma'lumotlar tuzilmalarining namunalari mavjud.
Har bir algoritm va ma'lumotlar tuzilmasining alohida README fayli
bo'lib, unda tegishli tushuntirishlar va qo'shimcha o'qish uchun
havolalar (shu jumladan YouTube videolariga ham havolalar) mavjud.
_Read this in other languages:_
[_简体中文_](README.zh-CN.md),
[_繁體中文_](README.zh-TW.md),
[_한국어_](README.ko-KR.md),
[_日本語_](README.ja-JP.md),
[_Polski_](README.pl-PL.md),
[_Français_](README.fr-FR.md),
[_Español_](README.es-ES.md),
[_Português_](README.pt-BR.md),
[_Русский_](README.ru-RU.md),
[_Türkçe_](README.tr-TR.md),
[_Italiana_](README.it-IT.md),
[_Bahasa Indonesia_](README.id-ID.md),
[_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
Yodda tuting, bu loyiha faqat o'quv va tadqiqot maqsadida ishlatilishi
uchun mo'ljallangan va ishlab chiqarishda ishlatilishi **mumkin emas**.
## Ma'lumotlar tuzilmalari
Ma'lumotlar tuzilmasi - bu kompyuterda ma'lumotlarni samarali tarzda
olish va o'zgartirish uchun ularni tashkil etish va saqlashning ma'lum
bir usuli. Ayniqsa, ma'lumotlar tuzilmasi ma'lumot qiymatlarining
to'plami, ular orasidagi munosabatlar va ma'lumotlarga qo'llanilishi
mumkin bo'lgan funksiyalar yoki operatsiyalardir.
`B` - Boshlang'ich, `A` - Ilg'or
- `B` [Bog'langan ro'yxat](src/data-structures/linked-list)
- `B` [Ikki marta bog'langan ro'yxat](src/data-structures/doubly-linked-list)
- `B` [Navbat](src/data-structures/queue)
- `B` [Stek](src/data-structures/stack)
- `B` [Hash jadvali](src/data-structures/hash-table)
- `B` [Heap](src/data-structures/heap) - maksimal va minimal heap versiyalari
- `B` [Ustuvor navbat](src/data-structures/priority-queue)
- `A` [Trie](src/data-structures/trie)
- `A` [Daraxt](src/data-structures/tree)
- `A` [Ikkilik qidiruv daraxt](src/data-structures/tree/binary-search-tree)
- `A` [AVL daraxt](src/data-structures/tree/avl-tree)
- `A` [Qizil-qora daraxt](src/data-structures/tree/red-black-tree)
- `A` [Segment daraxt](src/data-structures/tree/segment-tree) - min/max/sum diapazon so'rovlari bilan misollar
- `A` [Fenwick daraxt](src/data-structures/tree/fenwick-tree) (ikkilik indeksli daraxt)
- `A` [Graf](src/data-structures/graph) (yo'naltirilgan hamda yo'naltirilmagan)
- `A` [Ajratilgan to'plam](src/data-structures/disjoint-set) - union-find ma'lumotlar strukturasi yoki merge-find to'plami
- `A` [Bloom filtri](src/data-structures/bloom-filter)
- `A` [LRU keshi](src/data-structures/lru-cache/) - Eng kam ishlatilgan (LRU) keshi
## Algoritmlar
Algoritm muammolar sinfini qanday hal qilishning aniq spetsifikatsiyasi. Bu operatsiyalar ketma-ketligini aniqlaydigan qoidalar to'plami.
`B` - Boshlang'ich, `A` - Ilg'or
### Mavzu bo'yicha algoritmlar
- **Matematika**
- `B` [Bit manipulatsiyasi](src/algorithms/math/bits) - bitlarni qo'yish/olish/yangilash/tozalash, ikkilikka ko'paytirish/bo'lish, manfiy qilish va hokazo.
- `B` [Ikkilik suzuvchi nuqta](src/algorithms/math/binary-floating-point) - suzuvchi nuqtali sonlarning ikkilik tasviri.
- `B` [Faktorial](src/algorithms/math/factorial)
- `B` [Fibonachchi raqam](src/algorithms/math/fibonacci) - klassik va yopiq shakldagi versiyalar
- `B` [Asosiy omillar](src/algorithms/math/prime-factors) - tub omillarni topish va ularni Xardi-Ramanujan teoremasi yordamida sanash
- `B` [Birlamchilik testi](src/algorithms/math/primality-test) (sinov bo'linish usuli)
- `B` [Evklid algoritmi](src/algorithms/math/euclidean-algorithm) - eng katta umumiy bo'luvchini (EKUB) hisoblash
- `B` [Eng kichik umumiy karrali](src/algorithms/math/least-common-multiple) (EKUK)
- `B` [Eratosfen elagi](src/algorithms/math/sieve-of-eratosthenes) - berilgan chegaragacha barcha tub sonlarni topish
- `B` [Ikkining darajasimi](src/algorithms/math/is-power-of-two) - raqamning ikkining darajasi ekanligini tekshirish (sodda va bitli algoritmlar)
- `B` [Paskal uchburchagi](src/algorithms/math/pascal-triangle)
- `B` [Kompleks sonlar](src/algorithms/math/complex-number) - kompleks sonlar va ular bilan asosiy amallar
- `B` [Radian & Daraja](src/algorithms/math/radian) - radianlarni darajaga va orqaga aylantirish
- `B` [Tez ko'tarish](src/algorithms/math/fast-powering)
- `B` [Horner metodi](src/algorithms/math/horner-method) - polinomlarni baholash
- `B` [Matritsalar](src/algorithms/math/matrix) - matritsalar va asosiy matritsa operatsiyalari (ko'paytirish, transpozitsiya va boshqalar).
- `B` [Evklid masofasi](src/algorithms/math/euclidean-distance) - ikki nuqta/vektor/matritsa orasidagi masofa
- `A` [Butun sonlarni bo'lish](src/algorithms/math/integer-partition)
- `A` [Kvadrat ildiz](src/algorithms/math/square-root) - Nyuton metodi
- `A` [Liu Hui π algoritmi](src/algorithms/math/liu-hui) - N-gonlarga asoslangan π ning taxminiy hisoblari
- `A` [Diskret Furye transformatsiyasi](src/algorithms/math/fourier-transform) - vaqt funksiyasini (signalni) uni tashkil etuvchi chastotalarga ajratish
- **Sets**
- `B` [Karteziya maxsuloti](src/algorithms/sets/cartesian-product) - bir nechta to'plamlarning ko'paytmasi
- `B` [FisherYates Shuffle](src/algorithms/sets/fisher-yates) - chekli ketma-ketlikni tasodifiy almashtirish
- `A` [Power Set](src/algorithms/sets/power-set) - to'plamning barcha kichik to'plamlari (bitwise, backtracking va kaskadli echimlar)
- `A` [Permutatsiyalar](src/algorithms/sets/permutations) (takroriyalash bilan va takroriyalashsiz)
- `A` [Kombinatsiyalar](src/algorithms/sets/combinations) (takroriyalash bilan va takroriyalashsiz)
- `A` [Eng uzun umumiy ketma-ketlik](src/algorithms/sets/longest-common-subsequence) (LCS)
- `A` [Eng uzun ortib boruvchi ketma-ketlik](src/algorithms/sets/longest-increasing-subsequence)
- `A` [Eng qisqa umumiy ketma-ketlik](src/algorithms/sets/shortest-common-supersequence) (SCS)
- `A` [Knapsack muammosi](src/algorithms/sets/knapsack-problem) - "0/1" va "Bir-biriga bog'lanmagan"
- `A` [Maksimal kichik massiv](src/algorithms/sets/maximum-subarray) - Toʻliq kuch va dinamik dasturlash (Kadane usuli) versiyalari
- `A` [Kombinatsiya yig'indisi](src/algorithms/sets/combination-sum) - ma'lum summani tashkil etuvchi barcha kombinatsiyalarni topish
- **Stringlar**
- `B` [Hamming masofasi](src/algorithms/string/hamming-distance) - belgilarning bir-biridan farq qiladigan pozitsiyalar soni
- `B` [Palindrom](src/algorithms/string/palindrome) - satrning teskari tomoni ham bir xil ekanligini tekshirish
- `A` [Levenshtein masofasi](src/algorithms/string/levenshtein-distance) - ikki ketma-ketlik o'rtasidagi minimal tahrirlash masofasi
- `A` [KnuthMorrisPratt Algoritmi](src/algorithms/string/knuth-morris-pratt) (KMP Algoritmi) - kichik qatorlarni qidirish (mosh keluvchi naqshni qidirish)
- `A` [Z Algoritmi](src/algorithms/string/z-algorithm) - kichik qatorlarni qidirish (mosh keluvchi naqshni qidirish)
- `A` [Rabin Karp Algoritmi](src/algorithms/string/rabin-karp) - kichik qatorlarni qidirish
- `A` [Eng uzun umumiy kichik matn](src/algorithms/string/longest-common-substring)
- `A` [Regulyar ifoda moslashuvi](src/algorithms/string/regular-expression-matching) (RegEx)
- **Qidiruvlar**
- `B` [Linear qidirish](src/algorithms/search/linear-search)
- `B` [Jump qidirish](src/algorithms/search/jump-search) (yoki Blok qidirish) - saralangan qatorda qidirish
- `B` [Ikkilik qidirish](src/algorithms/search/binary-search) - saralangan qatorda qidirish
- `B` [Interpolatsiya qidirish](src/algorithms/search/interpolation-search) - bir tekis taqsimlangan saralangan qatorda qidirish
- **Tartiblash**
- `B` [Pufakcha tartiblash](src/algorithms/sorting/bubble-sort)
- `B` [Tanlash tartibi](src/algorithms/sorting/selection-sort)
- `B` [Kiritish tartibi](src/algorithms/sorting/insertion-sort)
- `B` [Heap tartibi](src/algorithms/sorting/heap-sort)
- `B` [Birlashtirish tartibi](src/algorithms/sorting/merge-sort)
- `B` [Tezkor saralash](src/algorithms/sorting/quick-sort) - joyida va joyida bo'lmagan amalga oshirish
- `B` [Shell tartiblash](src/algorithms/sorting/shell-sort)
- `B` [Sanash tartibi](src/algorithms/sorting/counting-sort)
- `B` [Radiksli tartiblash](src/algorithms/sorting/radix-sort)
- `B` [Bucket tartiblash](src/algorithms/sorting/bucket-sort)
- **Bog'langan ro'yhatlar**
- `B` [To'g'ri traversal](src/algorithms/linked-list/traversal)
- `B` [Teskari traversal](src/algorithms/linked-list/reverse-traversal)
- **Daraxtlar**
- `B` [Birinchi-pastga qarab qidirish](src/algorithms/tree/depth-first-search) (Depth-First Search)
- `B` [Birinchi-yonga qarab qidirish](src/algorithms/tree/breadth-first-search) (Breadth-First Search)
- **Grafiklar**
- `B` [Birinchi-pastga qarab qidirish](src/algorithms/graph/depth-first-search) (Depth-First Search)
- `B` [Birinchi-yonga qarab qidirish](src/algorithms/graph/breadth-first-search) (Breadth-First Search)
- `B` [Kruskal Algoritmi](src/algorithms/graph/kruskal) - og'irlikdagi yo'naltirilmagan grafik uchun Minimal kengayuvchi daraxtni (MST) topish
- `A` [Dijkstra Algoritmi](src/algorithms/graph/dijkstra) - grafikning bir cho'qqisidan qolgan barcha nuqtalarga eng qisqa yo'llarni topish
- `A` [Bellman-Ford Algoritmi](src/algorithms/graph/bellman-ford) - grafikning bir cho'qqisidan qolgan barcha nuqtalarga eng qisqa yo'llarni topish
- `A` [Floyd-Warshall Algoritmi](src/algorithms/graph/floyd-warshall) - grafikning barcha uchlari orasidagi eng qisqa masofalarni topish
- `A` [Siklni aniqlash](src/algorithms/graph/detect-cycle) - yo'naltirilgan va yo'naltirilmagan grafiklar uchun (DFS va Disjoint Set-ga asoslangan versiyalar)
- `A` [Prim Algoritmi](src/algorithms/graph/prim) - og'irlikdagi yo'naltirilmagan grafik uchun Minimal kengayuvchi daraxtni (MST) topish
- `A` [Topologik saralash](src/algorithms/graph/topological-sorting) - DFS metodi
- `A` [Artikulyatsiya nuqtalari](src/algorithms/graph/articulation-points) - Tarjan algoritmi (DFS asosida)
- `A` [Ko'priklar](src/algorithms/graph/bridges) - DFS asosidagi algoritm
- `A` [Eyler yo'li va Eyler sxemasi](src/algorithms/graph/eulerian-path) - Fleury algoritmi - Har bir chekkaga bir marta tashrif buyurish
- `A` [Gamilton sikli](src/algorithms/graph/hamiltonian-cycle) - Har bir cho'qqiga bir marta tashrif buyurish
- `A` [Kuchli bog'langan komponentlar](src/algorithms/graph/strongly-connected-components) - Kosaraju algoritmi
- `A` [Sayohatchi sotuvchi muammosi](src/algorithms/graph/travelling-salesman) - har bir shaharga tashrif buyuradigan va kelib chiqqan shaharga qaytib keladigan eng qisqa yo'l
- **Kriptografiya**
- `B` [Polynomial Hash](src/algorithms/cryptography/polynomial-hash) - polinomga asoslangan hash funktsiyasi
- `B` [Rail Fence Cipher](src/algorithms/cryptography/rail-fence-cipher) - xabarlarni kodlash uchun transpozitsiya shifrlash algoritmi
- `B` [Caesar Cipher](src/algorithms/cryptography/caesar-cipher) - oddiy almashtirish shifridir
- `B` [Hill Cipher](src/algorithms/cryptography/hill-cipher) - chiziqli algebraga asoslangan almashtirish shifri
- **Machine Learning**
- `B` [NanoNeuron](https://github.com/trekhleb/nano-neuron) - Mashinalar aslida qanday o'rganishi mumkinligini ko'rsatadigan 7 ta oddiy JS funksiyasi (forward/backward tarqalish)
- `B` [k-NN](src/algorithms/ml/knn) - eng yaqin qo'shnilarni tasniflash algoritmi
- `B` [k-Means](src/algorithms/ml/k-means) - k-Means kalsterlash algoritmi
- **Tasvirga ishlov berish**
- `B` [Seam Carving](src/algorithms/image-processing/seam-carving) - kontentga moslashuvchan rasm o'lchamini o'zgartirish algoritmi
- **Statistikalar**
- `B` [Weighted Random](src/algorithms/statistics/weighted-random) - elementlarning og'irligi asosida ro'yxatdan tasodifiy elementni tanlash
- **Evolyutsion algoritmlar**
- `A` [Genetik algoritm](https://github.com/trekhleb/self-parking-car-evolution) - avtoturargohni o'rgatish uchun genetik algoritm qanday qo'llanilishiga misol.
- **Kategoriyasiz**
- `B` [Xanoy minorasi](src/algorithms/uncategorized/hanoi-tower)
- `B` [Kvadrat matritsaning aylanishi](src/algorithms/uncategorized/square-matrix-rotation) - joyidagi algoritm
- `B` [Sakrash o'yini](src/algorithms/uncategorized/jump-game) - orqaga qaytish, dinamik dasturlash (yuqoridan pastga + pastdan yuqoriga) va ochko'z misollar
- `B` [Noyob yo'llar](src/algorithms/uncategorized/unique-paths) - orqaga qaytish, dinamik dasturlash va Paskal uchburchagiga asoslangan misolla
- `B` [Yomg'ir teraslari](src/algorithms/uncategorized/rain-terraces) - yomg'ir suvini ushlab turish muammosi (dinamik dasturlash va qo'pol kuch versiyalari)
- `B` [Rekursiv zinapoya](src/algorithms/uncategorized/recursive-staircase) - yuqoriga chiqish yo'llari sonini hisoblash (4 ta echim)
- `B` [Aksiyalarni sotib olish va sotish uchun eng yaxshi vaqt](src/algorithms/uncategorized/best-time-to-buy-sell-stocks) - bo'linib-zabt etish va bir marta o'tish misollari
- `A` [N-Queens Muommosi](src/algorithms/uncategorized/n-queens)
- `A` [Ritsar sayohati](src/algorithms/uncategorized/knight-tour)
### Paradigma bo'yicha algoritmlar
Algorithmic paradigm - bu algoritmlar sinfini loyihalashtirishga asos bo'lib xizmat qiladigan umumiy usul yoki yondashuv. Bu algoritm tushunchasidan yuqori darajadagi abstraktsiya bo'lib, algoritm kompyuter dasturi tushunchasidan yuqori darajadagi abstraktsiya bo'lgani kabi.
- **Brute Force** - barcha imkoniyatlarni ko'rib chiqib va eng yaxshi echimni tanlash
- `B` [Chiziqli qidirish](src/algorithms/search/linear-search)
- `B` [Yomg'irli teraslar](src/algorithms/uncategorized/rain-terraces) - yomg'ir suvini to'plash muammosi
- `B` [Rekursiv zinapoya](src/algorithms/uncategorized/recursive-staircase) - cho'qqiga chiqish yo'llari sonini hisoblash
- `A` [Maksimal kichik massiv](src/algorithms/sets/maximum-subarray)
- `A` [Sayohatchi sotuvchi muammosi](src/algorithms/graph/travelling-salesman) - har bir shaharga tashrif buyuradigan va kelib chiqqan shaharga qaytib keladigan eng qisqa yo'l
- `A` [Diskret Furye transformatsiyasi](src/algorithms/math/fourier-transform) - vaqt funksiyasini (signalni) uni tashkil etuvchi chastotalarga ajratish
- **Greedy** - kelajakni o'ylamasdan, hozirgi vaqtda eng yaxshi variantni tanlash
- `B` [Sakrash o'yini](src/algorithms/uncategorized/jump-game)
- `A` [Bog'lanmagan yukxalta muammosi](src/algorithms/sets/knapsack-problem)
- `A` [Dijkstra Algoritmi](src/algorithms/graph/dijkstra) - grafikning bir cho'qqisidan qolgan barcha nuqtalarga eng qisqa yo'llarni topish
- `A` [Prim Algoritmi](src/algorithms/graph/prim) - og'irlikdagi yo'naltirilmagan grafik uchun Minimal kengayuvchi daraxtni (MST) topish
- `A` [Kruskal Algoritmi](src/algorithms/graph/kruskal) - og'irlikdagi yo'naltirilmagan grafik uchun Minimal kengayuvchi daraxtni (MST) topish
- **Divide and Conquer** - muammoni kichikroq qismlarga bo'lib va keyin bu qismlarni hal qilish
- `B` [Ikkilik qidiruv](src/algorithms/search/binary-search)
- `B` [Xanoy minorasi](src/algorithms/uncategorized/hanoi-tower)
- `B` [Paskal uchburchagi](src/algorithms/math/pascal-triangle)
- `B` [Evklid Algoritmi](src/algorithms/math/euclidean-algorithm) - eng katta umumiy bo'luvchini (EKUB) hisoblash
- `B` [Birlashtirish tartibi](src/algorithms/sorting/merge-sort)
- `B` [Tezkor saralash](src/algorithms/sorting/quick-sort)
- `B` [Birinchi-pastga qarab qidirish daraxti](src/algorithms/tree/depth-first-search) (DFS)
- `B` [Birinchi-pastga qarab qidirish grafigi](src/algorithms/graph/depth-first-search) (DFS)
- `B` [Matritsalar](src/algorithms/math/matrix) - turli shakldagi matritsalarni hosil qilish va kesib o'tish
- `B` [Sakrash o'yini](src/algorithms/uncategorized/jump-game)
- `B` [Tez ko'tarish](src/algorithms/math/fast-powering)
- `B` [Aksiyalarni sotib olish va sotish uchun eng yaxshi vaqt](src/algorithms/uncategorized/best-time-to-buy-sell-stocks) - bo'linib-zabt etish va bir marta o'tish misollari
- `A` [Permutatsiyalar](src/algorithms/sets/permutations) (takroriyalash bilan va takroriyalashsiz)
- `A` [Kombinatsiyalar](src/algorithms/sets/combinations) (takroriyalash bilan va takroriyalashsiz)
- `A` [Maksimal kichik massiv](src/algorithms/sets/maximum-subarray)
- **Dinamik dasturlash** - ilgari topilgan kichik yechimlar yordamida yechim yaratish
- `B` [Fibonachchi raqam](src/algorithms/math/fibonacci)
- `B` [Sakrash o'yini](src/algorithms/uncategorized/jump-game)
- `B` [Noyob yo'llar](src/algorithms/uncategorized/unique-paths)
- `B` [Yomg'ir teraslari](src/algorithms/uncategorized/rain-terraces) - yomg'ir suvini to'plash muammosi
- `B` [Recursive Staircase](src/algorithms/uncategorized/recursive-staircase) - count the number of ways to reach to the top
- `B` [Seam Carving](src/algorithms/image-processing/seam-carving) - kontentga moslashuvchan rasm o'lchamini o'zgartirish algoritmi
- `A` [Levenshtein masofasi](src/algorithms/string/levenshtein-distance) - ikki ketma-ketlik o'rtasidagi minimal tahrirlash masofasi
- `A` [Eng uzun umumiy ketma-ketlik](src/algorithms/sets/longest-common-subsequence) (LCS)
- `A` [Eng uzun umumiy kichik matn](src/algorithms/string/longest-common-substring)
- `A` [Eng uzun ortib boruvchi ketma-ketlik](src/algorithms/sets/longest-increasing-subsequence)
- `A` [Eng qisqa umumiy ketma-ketlik](src/algorithms/sets/shortest-common-supersequence)
- `A` [0/1 Knapsak muommosi](src/algorithms/sets/knapsack-problem)
- `A` [Butun sonlarni bo'lish](src/algorithms/math/integer-partition)
- `A` [Maksimal kichik massiv](src/algorithms/sets/maximum-subarray)
- `A` [Bellman-Ford Algoritmi](src/algorithms/graph/bellman-ford) - grafikning bir cho'qqisidan qolgan barcha nuqtalarga eng qisqa yo'llarni topish
- `A` [Floyd-Warshall Algoritmi](src/algorithms/graph/floyd-warshall) -grafikning barcha uchlari orasidagi eng qisqa masofalarni topish
- `A` [Regulyar ifoda moslashuvi](src/algorithms/string/regular-expression-matching)
- **Backtracking** - brute forcega o'xshab, barcha mumkin bo'lgan yechimlarni generatsiya qilishga harakat qiladi, lekin har safar keyingi yechimni yaratganingizda, yechim barcha shartlarga javob beradimi yoki yo'qligini tekshirasiz va shundan keyingina keyingi yechimlarni ishlab chiqarishni davom ettirasiz. Aks holda, orqaga qaytib, yechim topishning boshqa yo'liga o'tasiz. Odatda state-space ning DFS-qidiruvi ishlatiladi.
- `B` [Sakrash o'yini](src/algorithms/uncategorized/jump-game)
- `B` [Noyob yo'llar](src/algorithms/uncategorized/unique-paths)
- `B` [Power Set](src/algorithms/sets/power-set) - to'plamning barcha kichik to'plamlari
- `A` [Gamilton sikli](src/algorithms/graph/hamiltonian-cycle) - Har bir cho'qqiga bir marta tashrif buyurish
- `A` [N-Queens muommosi](src/algorithms/uncategorized/n-queens)
- `A` [Ritsar sayohati](src/algorithms/uncategorized/knight-tour)
- `A` [Kombinatsiya yig'indisi](src/algorithms/sets/combination-sum) - ma'lum summani tashkil etuvchi barcha kombinatsiyalarni topish
- **Branch & Bound** - shu paytgacha topilgan eng arzon echimdan kattaroq xarajatlarga ega qisman echimlarni bekor qilish uchun, backtracking qidiruvining har bir bosqichida topilgan eng arzon echimni eslab qoling va shu paytgacha topilgan eng arzon yechim narxidan muammoni eng kam xarajatli yechim narxining past chegarasi sifatida foydalaning. Odatda state-space daraxtining DFS o'tishi bilan birgalikda BFS traversal qo'llaniladi.
## Ushbu repozitoriyadan qanday foydalanish kerak
**Barcha dependensiylarni o'rnating**
```
npm install
```
**ESLint ni ishga tushiring**
Kod sifatini tekshirish uchun ESLint ni ishga tushirishingiz mumkin.
```
npm run lint
```
**Barcha testlarni ishga tushuring**
```
npm test
```
**Testlarni nom bo'yicha ishga tushirish**
```
npm test -- 'LinkedList'
```
**Muammolarni bartaraf qilish (Troubleshooting)**
Agar linting yoki sinov muvaffaqiyatsiz bo'lsa, `node_modules` papkasini o'chirib, npm paketlarini qayta o'rnatishga harakat qiling:
```
rm -rf ./node_modules
npm i
```
Shuningdek, to'g'ri Node versiyasidan foydalanayotganingizga ishonch hosil qiling (`>=16`). Agar Node versiyasini boshqarish uchun [nvm](https://github.com/nvm-sh/nvm) dan foydalanayotgan bo'lsangiz, loyihaning ildiz papkasidan `nvm use` ni ishga tushiring va to'g'ri versiya tanlanadi.
**O'yin maydoni (Playground)**
`./src/playground/playground.js` faylida ma'lumotlar strukturalari va algoritmlar bilan o'ynashingiz, `./src/playground/test/playground.test.js` faylida esa ular uchun testlar yozishingiz mumkin.
Shundan so'ng, playground kodingiz kutilgandek ishlashini tekshirish uchun quyidagi buyruqni ishga tushirishingiz kifoya:
```
npm test -- 'playground'
```
## Foydali ma'lumotlar
### Manbalar
- [▶ Data Structures and Algorithms on YouTube](https://www.youtube.com/playlist?list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)
- [✍🏻 Data Structure Sketches](https://okso.app/showcase/data-structures)
### Big O Notation
_Big O notation_ algoritmlarni kirish hajmi oshgani sayin ularning ishlash vaqti yoki bo'sh joy talablari qanday o'sishiga qarab tasniflash uchun ishlatiladi. Quyidagi jadvalda siz Big O notatsiyasida ko'rsatilgan algoritmlarning o'sishining eng keng tarqalgan tartiblarini topishingiz mumkin.
![Big O grafiklar](./assets/big-o-graph.png)
Manba: [Big O Cheat Sheet](http://bigocheatsheet.com/).
Quyida eng ko'p qo'llaniladigan Big O notatsiyalarining ro'yxati va ularning kirish ma'lumotlarining turli o'lchamlariga nisbatan ishlashini taqqoslash keltirilgan.
| Big O Notatsiya | Turi | 10 ta element uchun hisob-kitoblar | 100 ta element uchun hisob-kitoblar | 1000 ta element uchun hisob-kitoblar |
| --------------- | ------------ | ---------------------------------- | ----------------------------------- | ------------------------------------ |
| **O(1)** | O'zgarmas | 1 | 1 | 1 |
| **O(log N)** | Logarifmik | 3 | 6 | 9 |
| **O(N)** | Chiziqli | 10 | 100 | 1000 |
| **O(N log N)** | n log(n) | 30 | 600 | 9000 |
| **O(N^2)** | Kvadrat | 100 | 10000 | 1000000 |
| **O(2^N)** | Eksponensial | 1024 | 1.26e+29 | 1.07e+301 |
| **O(N!)** | Faktorial | 3628800 | 9.3e+157 | 4.02e+2567 |
### Ma'lumotlar tuzilmalarining operatsiyalari murakkabligi
| Ma'lumotlar tuzilmalari | Kirish | Qidirish | Kiritish | O'chirish | Izohlar |
| --------------------------- | :----: | :------: | :------: | :-------: | :--------------------------------------------------------- |
| **Massiv** | 1 | n | n | n | |
| **Stak** | n | n | 1 | 1 | |
| **Navbat** | n | n | 1 | 1 | |
| **Bog'langan ro'yhat** | n | n | 1 | n | |
| **Hash jadval** | - | n | n | n | Mukammal xash funksiyasi bo'lsa, xarajatlar O (1) bo'ladi. |
| **Ikkilik qidiruv daraxti** | n | n | n | n | Balanslangan daraxt narxida O(log(n)) bo'ladi. |
| **B-daraxti** | log(n) | log(n) | log(n) | log(n) | |
| **Qizil-qora daraxt** | log(n) | log(n) | log(n) | log(n) | |
| **AVL Daraxt** | log(n) | log(n) | log(n) | log(n) | |
| **Bloom filtri** | - | 1 | 1 | - | Qidiruv paytida noto'g'ri pozitivlar bo'lishi mumkin |
### Massivlarni saralash algoritmlarining murakkabligi
| Nomi | Eng yaxshi | O'rta | Eng yomon | Xotira | Barqaror | Izohlar |
| ------------------------- | :-----------: | :---------------------: | :-------------------------: | :----: | :------: | :--------------------------------------------------------------------------- |
| **Pufakcha tartiblash** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | Ha | |
| **Kiritish tartibi** | n | n<sup>2</sup> | n<sup>2</sup> | 1 | Ha | |
| **Tanlash tartibi** | n<sup>2</sup> | n<sup>2</sup> | n<sup>2</sup> | 1 | Yo'q | |
| **Heap tartibi** | n&nbsp;log(n) | n&nbsp;log(n) | n&nbsp;log(n) | 1 | Yo'q | |
| **Birlashtirish tartibi** | n&nbsp;log(n) | n&nbsp;log(n) | n&nbsp;log(n) | n | Ha | |
| **Tezkor saralash** | n&nbsp;log(n) | n&nbsp;log(n) | n<sup>2</sup> | log(n) | Yo'q | Tezkor saralash odatda O(log(n)) stek maydoni bilan joyida amalga oshiriladi |
| **Shell tartiblash** | n&nbsp;log(n) | depends on gap sequence | n&nbsp;(log(n))<sup>2</sup> | 1 | Yo'q | |
| **Sanash tartibi** | n + r | n + r | n + r | n + r | Ha | r - massivdagi eng katta raqam |
| **Radiksli tartiblash** | n \* k | n \* k | n \* k | n + k | Ha | k - eng uzun kalitning uzunligi |
## Loyihani qo'llab-quvvatlovchilar
> Siz ushbu loyihani ❤️️ [GitHub](https://github.com/sponsors/trekhleb) yoki ❤️️ [Patreon](https://www.patreon.com/trekhleb) orqali qo'llab-quvvatlashingiz mumkin.
[Ushbu loyihani qo'llab-quvvatlagan odamlar](https://github.com/trekhleb/javascript-algorithms/blob/master/BACKERS.md) `∑ = 1`
## Muallif
[@trekhleb](https://trekhleb.dev)
A few more [projects](https://trekhleb.dev/projects/) and [articles](https://trekhleb.dev/blog/) about JavaScript and algorithms on [trekhleb.dev](https://trekhleb.dev)

View File

@ -23,7 +23,8 @@ _Read this in other languages:_
[_Українська_](README.uk-UA.md), [_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md), [_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md), [_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md) [_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
*注意:这个项目仅用于学习和研究,**不是**用于生产环境。* *注意:这个项目仅用于学习和研究,**不是**用于生产环境。*

View File

@ -22,7 +22,8 @@ _Read this in other languages:_
[_Українська_](README.uk-UA.md), [_Українська_](README.uk-UA.md),
[_Arabic_](README.ar-AR.md), [_Arabic_](README.ar-AR.md),
[_Tiếng Việt_](README.vi-VN.md), [_Tiếng Việt_](README.vi-VN.md),
[_Deutsch_](README.de-DE.md) [_Deutsch_](README.de-DE.md),
[_Uzbek_](README.uz-UZ.md)
## 資料結構 ## 資料結構

View File

@ -0,0 +1,27 @@
# Búsqueda binaria
_Lea esto en otros idiomas:_
[English](README.md)
[Português brasileiro](README.pt-BR.md).
En informática, la búsqueda binaria, también conocida como búsqueda de medio intervalo
búsqueda, búsqueda logarítmica, o corte binario, es un algoritmo de búsqueda
que encuentra la posición de un valor objetivo dentro de una matriz
ordenada. La búsqueda binaria compara el valor objetivo con el elemento central
de la matriz; si son desiguales, se elimina la mitad en la que
la mitad en la que no puede estar el objetivo se elimina y la búsqueda continúa
en la mitad restante hasta que tenga éxito. Si la búsqueda
termina con la mitad restante vacía, el objetivo no está
en la matriz.
![Búsqueda binaria](https://upload.wikimedia.org/wikipedia/commons/8/83/Binary_Search_Depiction.svg)
## Complejidad
**Complejidad de tiempo**: `O(log(n))` - ya que dividimos el área de búsqueda en dos para cada
siguiente iteración.
## Referencias
- [Wikipedia](https://en.wikipedia.org/wiki/Binary_search_algorithm)
- [YouTube](https://www.youtube.com/watch?v=P3YID7liBug&index=29&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)

View File

@ -2,15 +2,16 @@
_Read this in other languages:_ _Read this in other languages:_
[Português brasileiro](README.pt-BR.md). [Português brasileiro](README.pt-BR.md).
[Español](README.es-ES.md).
In computer science, binary search, also known as half-interval In computer science, binary search, also known as half-interval
search, logarithmic search, or binary chop, is a search algorithm search, logarithmic search, or binary chop, is a search algorithm
that finds the position of a target value within a sorted that finds the position of a target value within a sorted
array. Binary search compares the target value to the middle array. Binary search compares the target value to the middle
element of the array; if they are unequal, the half in which element of the array; if they are unequal, the half in which
the target cannot lie is eliminated and the search continues the target cannot lie is eliminated and the search continues
on the remaining half until it is successful. If the search on the remaining half until it is successful. If the search
ends with the remaining half being empty, the target is not ends with the remaining half being empty, the target is not
in the array. in the array.
![Binary Search](https://upload.wikimedia.org/wikipedia/commons/8/83/Binary_Search_Depiction.svg) ![Binary Search](https://upload.wikimedia.org/wikipedia/commons/8/83/Binary_Search_Depiction.svg)

View File

@ -2,6 +2,7 @@
_Leia isso em outras línguas:_ _Leia isso em outras línguas:_
[english](README.md). [english](README.md).
[Español](README.es-ES.md).
Em ciência da computação, busca binária, também conhecida como busca de meio-intervalo, busca logarítmica ou corte binário, é um algoritmo de pesquisa Em ciência da computação, busca binária, também conhecida como busca de meio-intervalo, busca logarítmica ou corte binário, é um algoritmo de pesquisa
que encontra a posição de um elemento alvo dentro de um que encontra a posição de um elemento alvo dentro de um

View File

@ -46,7 +46,7 @@ Let's say we have an array of prices `[7, 6, 4, 3, 1]` and we're on the _1st_ da
1. _Option 1: Keep the money_ → profit would equal to the profit from buying/selling the rest of the stocks → `keepProfit = profit([6, 4, 3, 1])`. 1. _Option 1: Keep the money_ → profit would equal to the profit from buying/selling the rest of the stocks → `keepProfit = profit([6, 4, 3, 1])`.
2. _Option 2: Buy/sell at current price_ → profit in this case would equal to the profit from buying/selling the rest of the stocks plus (or minus, depending on whether we're selling or buying) the current stock price → `buySellProfit = -7 + profit([6, 4, 3, 1])`. 2. _Option 2: Buy/sell at current price_ → profit in this case would equal to the profit from buying/selling the rest of the stocks plus (or minus, depending on whether we're selling or buying) the current stock price → `buySellProfit = -7 + profit([6, 4, 3, 1])`.
The overall profit would be equal to → `overalProfit = Max(keepProfit, buySellProfit)`. The overall profit would be equal to → `overallProfit = Max(keepProfit, buySellProfit)`.
As you can see the `profit([6, 4, 3, 1])` task is being solved in the same recursive manner. As you can see the `profit([6, 4, 3, 1])` task is being solved in the same recursive manner.

View File

@ -59,7 +59,7 @@ and return false.
queen here leads to a solution. queen here leads to a solution.
b) If placing queen in [row, column] leads to a solution then return b) If placing queen in [row, column] leads to a solution then return
true. true.
c) If placing queen doesn't lead to a solution then umark this [row, c) If placing queen doesn't lead to a solution then unmark this [row,
column] (Backtrack) and go to step (a) to try other rows. column] (Backtrack) and go to step (a) to try other rows.
3) If all rows have been tried and nothing worked, return false to trigger 3) If all rows have been tried and nothing worked, return false to trigger
backtracking. backtracking.

View File

@ -93,7 +93,7 @@ three factors: the size of the bloom filter, the
number of hash functions we use, and the number number of hash functions we use, and the number
of items that have been inserted into the filter. of items that have been inserted into the filter.
The formula to calculate probablity of a false positive is: The formula to calculate probability of a false positive is:
( 1 - e <sup>-kn/m</sup> ) <sup>k</sup> ( 1 - e <sup>-kn/m</sup> ) <sup>k</sup>

View File

@ -279,7 +279,7 @@ export default class Heap {
/* istanbul ignore next */ /* istanbul ignore next */
pairIsInCorrectOrder(firstElement, secondElement) { pairIsInCorrectOrder(firstElement, secondElement) {
throw new Error(` throw new Error(`
You have to implement heap pair comparision method You have to implement heap pair comparison method
for ${firstElement} and ${secondElement} values. for ${firstElement} and ${secondElement} values.
`); `);
} }

View File

@ -7,9 +7,9 @@ _Lee este artículo en otros idiomas:_
[_Português_](README.pt-BR.md) [_Português_](README.pt-BR.md)
[_English_](README.md) [_English_](README.md)
En ciencias de la computaciòn una **lista enlazada** es una coleccion linear En ciencias de la computación una **lista enlazada** es una colección lineal
de elementos de datos, en los cuales el orden linear no es dado por de elementos, en los cuales el orden lineal no es dado por
su posciòn fisica en memoria. En cambio, cada su posición física en memoria. En cambio, cada
elemento señala al siguiente. Es una estructura de datos elemento señala al siguiente. Es una estructura de datos
que consiste en un grupo de nodos los cuales juntos representan que consiste en un grupo de nodos los cuales juntos representan
una secuencia. En su forma más sencilla, cada nodo está una secuencia. En su forma más sencilla, cada nodo está
@ -19,10 +19,10 @@ permite la inserción o eliminación de elementos
desde cualquier posición en la secuencia durante la iteración. desde cualquier posición en la secuencia durante la iteración.
Las variantes más complejas agregan enlaces adicionales, permitiendo Las variantes más complejas agregan enlaces adicionales, permitiendo
una eficiente inserción o eliminación desde referencias arbitrarias una eficiente inserción o eliminación desde referencias arbitrarias
del elemento. Una desventaja de las listas lazadas es que el tiempo de del elemento. Una desventaja de las listas enlazadas es que el tiempo de
acceso es lineal (y difícil de canalizar). Un acceso acceso es lineal (y difícil de canalizar). Un acceso
más rápido, como un acceso aleatorio, no es factible. Los arreglos más rápido, como un acceso aleatorio, no es factible. Los arreglos
tienen una mejor locazion en caché comparados con las listas lazadas. tienen una mejor localización en caché comparados con las listas enlazadas.
![Linked List](./images/linked-list.jpeg) ![Linked List](./images/linked-list.jpeg)
@ -112,7 +112,7 @@ Remove(head, value)
end Remove end Remove
``` ```
### Atrevesar ### Atravesar
```text ```text
Traverse(head) Traverse(head)

View File

@ -1,10 +1,10 @@
# Зв'язаний список # Зв'язаний список
Зв'язаний список — базова динамічна структура даних в інформатиці, що складається з вузлів, кожен з яких містить як дані, так посилання («зв'язку») на наступний вузол списку. Дана структура дозволяє ефективно додавати та видаляти елементи на довільній позиції у послідовності у процесі ітерації. Більш складні варіанти включають додаткові посилання, що дозволяють ефективно додавати та видаляти довільні елементи. Зв'язаний список — базова динамічна структура даних в інформатиці, що складається з вузлів, кожен з яких містить як дані, так і посилання («зв'язку») на наступний вузол списку. Ця структура даних дозволяє ефективно додавати та видаляти елементи на довільній позиції у послідовності у процесі ітерації. Більш складні варіанти включають додаткові посилання, що дозволяють ефективно додавати та видаляти довільні елементи.
Принциповою перевагою перед масивом є структурна гнучкість: порядок елементів зв'язкового списку може збігатися з порядком розташування елементів даних у пам'яті комп'ютера, а порядок обходу списку завжди явно задається його внутрішніми зв'язками. Суть переваги у тому, що у багатьох мовах створення масиву вимагає вказати його заздалегідь. Зв'язковий список дозволяє обійти це обмеження. Принциповою перевагою перед масивом є структурна гнучкість: порядок елементів зв'язаного списку може збігатися з порядком розташування елементів даних у пам'яті комп'ютера, а порядок обходу списку завжди явно задається його внутрішніми зв'язками. Це важливо, бо у багатьох мовах створення масиву вимагає вказати його розмір заздалегідь. Зв'язаний список дозволяє обійти це обмеження.
Недоліком зв'язкових списків є те, що час доступу є лінійним (і важко для реалізації конвеєрів). Неможливий швидкий доступ (випадковий). Недоліком зв'язаних списків є те, що час доступу є лінійним (і важко для реалізації конвеєрів). Неможливий швидкий доступ (випадковий).
![Linked List](./images/linked-list.jpeg) ![Linked List](./images/linked-list.jpeg)
@ -17,7 +17,7 @@
```text ```text
Add(value) Add(value)
Pre: value - значення, що додається Pre: value - значення, що додається
Post: value поміщено в кінець списку Post: value додано в кінець списку
n ← node(value) n ← node(value)
if head = ø if head = ø
head ← n head ← n
@ -32,7 +32,7 @@ end Add
```text ```text
Prepend(value) Prepend(value)
Pre: value - значення, що додається Pre: value - значення, що додається
Post: value поміщено на початок списку Post: value додано на початку списку
n ← node(value) n ← node(value)
n.next ← head n.next ← head
head ← n head ← n
@ -42,7 +42,7 @@ Prepend(value)
end Prepend end Prepend
``` ```
### Поиск ### Пошук
```text ```text
Contains(head, value) Contains(head, value)
@ -60,7 +60,7 @@ Contains(head, value)
end Contains end Contains
``` ```
### Вилучення ### Видалення
```text ```text
Remove(head, value) Remove(head, value)
@ -94,7 +94,7 @@ Remove(head, value)
end Remove end Remove
``` ```
### Обход ### Обхід
```text ```text
Traverse(head) Traverse(head)
@ -108,12 +108,12 @@ Traverse(head)
end Traverse end Traverse
``` ```
### Зворотний обхід ### Зворотній обхід
```text ```text
ReverseTraversal(head, tail) ReverseTraversal(head, tail)
Pre: head и tail відносяться до одного списку Pre: head і tail відносяться до одного списку
Post: елементи списку пройдено у зворотному порядку Post: елементи списку пройдено у зворотньому порядку
if tail != ø if tail != ø
curr ← tail curr ← tail
while curr != head while curr != head
@ -131,7 +131,7 @@ end ReverseTraversal
## Складність ## Складність
### Тимчасова складність ### Часова складність
| Читання | Пошук | Вставка | Вилучення | | Читання | Пошук | Вставка | Вилучення |
| :--------: | :-------: | :--------: | :-------: | | :--------: | :-------: | :--------: | :-------: |
@ -143,5 +143,5 @@ O(n)
## Посилання ## Посилання
- [Wikipedia](https://uk.wikipedia.org/wiki/%D0%97%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) - [Wikipedia](https://uk.wikipedia.org/wiki/Зв'язаний_список)
- [YouTube](https://www.youtube.com/watch?v=6snsMa4E1Os) - [YouTube](https://www.youtube.com/watch?v=6snsMa4E1Os)

View File

@ -0,0 +1,51 @@
# LRU 캐시 알고리즘
**LRU 캐시 알고리즘** 은 사용된 순서대로 아이템을 정리함으로써, 오랜 시간 동안 사용되지 않은 아이템을 빠르게 찾아낼 수 있도록 한다.
한방향으로만 옷을 걸 수 있는 옷걸이 행거를 생각해봅시다. 가장 오랫동안 입지 않은 옷을 찾기 위해서는, 행거의 반대쪽 끝을 보면 됩니다.
## 문제 정의
LRUCache 클래스를 구현해봅시다:
- `LRUCache(int capacity)` LRU 캐시를 **양수**`capacity` 로 초기화합니다.
- `int get(int key)` `key` 가 존재할 경우 `key` 값을 반환하고, 그렇지 않으면 `undefined` 를 반환합니다.
- `void set(int key, int value)` `key` 가 존재할 경우 `key` 값을 업데이트 하고, 그렇지 않으면 `key-value` 쌍을 캐시에 추가합니다. 만약 이 동작으로 인해 키 개수가 `capacity` 를 넘는 경우, 가장 오래된 키 값을 **제거** 합니다.
`get()``set()` 함수는 무조건 평균 `O(1)` 의 시간 복잡도 내에 실행되어야 합니다.
## 구현
### 버전 1: 더블 링크드 리스트 + 해시맵
[LRUCache.js](./LRUCache.js) 에서 `LRUCache` 구현체 예시를 확인할 수 있습니다. 예시에서는 (평균적으로) 빠른 `O(1)` 캐시 아이템 접근을 위해 `HashMap` 을 사용했고, (평균적으로) 빠른 `O(1)` 캐시 아이템 수정과 제거를 위해 `DoublyLinkedList` 를 사용했습니다. (허용된 최대의 캐시 용량을 유지하기 위해)
![Linked List](./images/lru-cache.jpg)
_[okso.app](https://okso.app) 으로 만듦_
LRU 캐시가 어떻게 작동하는지 더 많은 예시로 확인하고 싶다면 LRUCache.test.js](./**test**/LRUCache.test.js) 파일을 참고하세요.
### 버전 2: 정렬된 맵
더블 링크드 리스트로 구현한 첫번째 예시는 어떻게 평균 `O(1)` 시간 복잡도가 `set()``get()` 으로 나올 수 있는지 학습 목적과 이해를 돕기 위해 좋은 예시입니다.
그러나, 더 쉬운 방법은 자바스크립트의 [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) 객체를 사용하는 것입니다. 이 `Map` 객체는 키-값 쌍과 키를 **추가하는 순서 원본** 을 지닙니다. 우리는 이걸 아이템을 제거하거나 다시 추가하면서 맵의 "가장 마지막" 동작에서 최근에 사용된 아이템을 유지하기 위해 사용할 수 있습니다. `Map` 의 시작점에 있는 아이템은 캐시 용량이 넘칠 경우 가장 먼저 제거되는 대상입니다. 아이템의 순서는 `map.keys()` 와 같은 `IterableIterator` 을 사용해 확인할 수 있습니다.
해당 구현체는 [LRUCacheOnMap.js](./LRUCacheOnMap.js) 의 `LRUCacheOnMap` 예시에서 확인할 수 있습니다.
이 LRU 캐시 방식이 어떻게 작동하는지 더 많은 테스트 케이스를 확인하고 싶다면 [LRUCacheOnMap.test.js](./__test__/LRUCacheOnMap.test.js) 파일을 참고하세요.
## 복잡도
| | 평균 |
| --------------- | ------ |
| 공간 | `O(n)` |
| 아이템 찾기 | `O(1)` |
| 아이템 설정하기 | `O(1)` |
## 참조
- [LRU Cache on LeetCode](https://leetcode.com/problems/lru-cache/solutions/244744/lru-cache/)
- [LRU Cache on InterviewCake](https://www.interviewcake.com/concept/java/lru-cache)
- [LRU Cache on Wiki](https://en.wikipedia.org/wiki/Cache_replacement_policies)

View File

@ -1,5 +1,8 @@
# Least Recently Used (LRU) Cache # Least Recently Used (LRU) Cache
_Read this in other languages:_
[한국어](README.ko-KR.md),
A **Least Recently Used (LRU) Cache** organizes items in order of use, allowing you to quickly identify which item hasn't been used for the longest amount of time. A **Least Recently Used (LRU) Cache** organizes items in order of use, allowing you to quickly identify which item hasn't been used for the longest amount of time.
Picture a clothes rack, where clothes are always hung up on one side. To find the least-recently used item, look at the item on the other end of the rack. Picture a clothes rack, where clothes are always hung up on one side. To find the least-recently used item, look at the item on the other end of the rack.
@ -22,7 +25,7 @@ See the `LRUCache` implementation example in [LRUCache.js](./LRUCache.js). The s
![Linked List](./images/lru-cache.jpg) ![Linked List](./images/lru-cache.jpg)
*Made with [okso.app](https://okso.app)* _Made with [okso.app](https://okso.app)_
You may also find more test-case examples of how the LRU Cache works in [LRUCache.test.js](./__test__/LRUCache.test.js) file. You may also find more test-case examples of how the LRU Cache works in [LRUCache.test.js](./__test__/LRUCache.test.js) file.
@ -38,11 +41,11 @@ You may also find more test-case examples of how the LRU Cache works in [LRUCach
## Complexities ## Complexities
| | Average | | | Average |
|---|---| | -------- | ------- |
| Space |`O(n)`| | Space | `O(n)` |
| Get item | `O(1)` | | Get item | `O(1)` |
| Set item | `O(1)` | | Set item | `O(1)` |
## References ## References

View File

@ -10,8 +10,8 @@
Додаткова операція для читання головного елемента (peek) дає доступ Додаткова операція для читання головного елемента (peek) дає доступ
до останнього елементу стека без зміни самого стека. до останнього елементу стека без зміни самого стека.
Найчастіше принцип роботи стека порівнюють зі чаркою тарілок: щоб узяти другу Найчастіше принцип роботи стека порівнюють із стопкою тарілок: щоб узяти другу
зверху потрібно зняти верхню. зверху потрібно спочатку зняти верхню.
Ілюстрація роботи зі стеком. Ілюстрація роботи зі стеком.