From 08149bb84c7af763ac368bcfe91de2c3461f36b4 Mon Sep 17 00:00:00 2001 From: Yashwanth Date: Sun, 1 Nov 2026 22:24:14 -0800 Subject: [PATCH 1/2] Add Telugu translation of READMEs Translate the main README and all 111 algorithm and data-structure READMEs into spoken Telugu (README.tel-IN.md). Technical terms stay in English, as Telugu developers use them; code blocks are unchanged. Link the Telugu version from the English READMEs and from every existing translation that has a language list. Co-Authored-By: Claude Opus 5.5 --- README.ar-AR.md | 3 +- README.de-DE.md | 3 +- README.es-ES.md | 3 +- README.fr-FR.md | 3 +- README.he-IL.md | 3 +- README.id-ID.md | 3 +- README.it-IT.md | 3 +- README.ja-JP.md | 3 +- README.ko-KR.md | 3 +- README.md | 3 +- README.pl-PL.md | 3 +- README.pt-BR.md | 3 +- README.ru-RU.md | 3 +- README.tel-IN.md | 370 +++++++++++++ README.tr-TR.md | 3 +- README.uk-UA.md | 3 +- README.uz-UZ.md | 3 +- README.vi-VN.md | 3 +- README.zh-CN.md | 3 +- README.zh-TW.md | 3 +- .../cryptography/caesar-cipher/README.md | 3 +- .../caesar-cipher/README.tel-IN.md | 34 ++ .../cryptography/hill-cipher/README.md | 3 + .../cryptography/hill-cipher/README.tel-IN.md | 98 ++++ .../cryptography/polynomial-hash/README.md | 3 + .../polynomial-hash/README.tel-IN.md | 112 ++++ .../cryptography/rail-fence-cipher/README.md | 3 + .../rail-fence-cipher/README.tel-IN.md | 31 ++ .../graph/articulation-points/README.md | 3 + .../articulation-points/README.tel-IN.md | 24 + src/algorithms/graph/bellman-ford/README.md | 3 + .../graph/bellman-ford/README.tel-IN.md | 22 + .../graph/breadth-first-search/README.md | 3 + .../breadth-first-search/README.tel-IN.md | 18 + src/algorithms/graph/bridges/README.md | 3 + src/algorithms/graph/bridges/README.tel-IN.md | 29 + .../graph/depth-first-search/README.md | 3 + .../graph/depth-first-search/README.tel-IN.md | 18 + src/algorithms/graph/detect-cycle/README.md | 3 + .../graph/detect-cycle/README.tel-IN.md | 58 ++ src/algorithms/graph/dijkstra/README.de-DE.md | 3 +- src/algorithms/graph/dijkstra/README.es-ES.md | 3 +- src/algorithms/graph/dijkstra/README.fr-FR.md | 3 +- src/algorithms/graph/dijkstra/README.he-IL.md | 3 +- src/algorithms/graph/dijkstra/README.ja-JP.md | 3 +- src/algorithms/graph/dijkstra/README.ko-KR.md | 3 +- src/algorithms/graph/dijkstra/README.md | 3 +- .../graph/dijkstra/README.tel-IN.md | 139 +++++ src/algorithms/graph/dijkstra/README.uk-UA.md | 3 +- src/algorithms/graph/dijkstra/README.zh-CN.md | 3 +- src/algorithms/graph/dijkstra/README.zh-TW.md | 3 +- src/algorithms/graph/eulerian-path/README.md | 3 + .../graph/eulerian-path/README.tel-IN.md | 32 ++ src/algorithms/graph/floyd-warshall/README.md | 3 + .../graph/floyd-warshall/README.tel-IN.md | 95 ++++ .../graph/hamiltonian-cycle/README.md | 3 + .../graph/hamiltonian-cycle/README.tel-IN.md | 46 ++ src/algorithms/graph/kruskal/README.md | 3 +- src/algorithms/graph/kruskal/README.tel-IN.md | 45 ++ src/algorithms/graph/prim/README.md | 3 + src/algorithms/graph/prim/README.tel-IN.md | 43 ++ .../strongly-connected-components/README.md | 3 + .../README.tel-IN.md | 18 + .../graph/topological-sorting/README.md | 3 + .../topological-sorting/README.tel-IN.md | 54 ++ .../graph/travelling-salesman/README.md | 3 + .../travelling-salesman/README.tel-IN.md | 26 + .../image-processing/seam-carving/README.md | 3 + .../seam-carving/README.tel-IN.md | 512 ++++++++++++++++++ .../linked-list/reverse-traversal/README.md | 3 +- .../reverse-traversal/README.pt-BR.md | 3 +- .../reverse-traversal/README.tel-IN.md | 24 + .../linked-list/traversal/README.md | 3 +- .../linked-list/traversal/README.pt-BR.md | 3 +- .../linked-list/traversal/README.tel-IN.md | 25 + .../math/binary-floating-point/README.md | 3 + .../binary-floating-point/README.tel-IN.md | 108 ++++ src/algorithms/math/bits/README.fr-FR.md | 3 +- src/algorithms/math/bits/README.md | 3 +- src/algorithms/math/bits/README.tel-IN.md | 273 ++++++++++ src/algorithms/math/bits/README.zh-CN.md | 3 +- .../math/complex-number/README.fr-FR.md | 3 +- src/algorithms/math/complex-number/README.md | 3 +- .../math/complex-number/README.tel-IN.md | 220 ++++++++ .../math/euclidean-algorithm/README.fr-FR.md | 3 +- .../math/euclidean-algorithm/README.md | 3 +- .../math/euclidean-algorithm/README.tel-IN.md | 47 ++ .../math/euclidean-distance/README.md | 3 + .../math/euclidean-distance/README.tel-IN.md | 39 ++ src/algorithms/math/factorial/README.fr-FR.md | 3 +- src/algorithms/math/factorial/README.md | 3 +- .../math/factorial/README.tel-IN.md | 34 ++ src/algorithms/math/factorial/README.tr-TR.md | 3 +- src/algorithms/math/factorial/README.uk-UA.md | 3 +- .../math/fast-powering/README.fr-FR.md | 3 +- src/algorithms/math/fast-powering/README.md | 3 +- .../math/fast-powering/README.tel-IN.md | 72 +++ src/algorithms/math/fibonacci/README.fr-FR.md | 3 +- src/algorithms/math/fibonacci/README.md | 3 +- .../math/fibonacci/README.tel-IN.md | 25 + src/algorithms/math/fibonacci/README.zh-CN.md | 3 +- .../math/fourier-transform/README.fr-FR.md | 3 +- .../math/fourier-transform/README.md | 3 +- .../math/fourier-transform/README.tel-IN.md | 127 +++++ src/algorithms/math/horner-method/README.md | 3 + .../math/horner-method/README.tel-IN.md | 23 + .../math/integer-partition/README.md | 3 + .../math/integer-partition/README.tel-IN.md | 33 ++ src/algorithms/math/is-power-of-two/README.md | 3 + .../math/is-power-of-two/README.tel-IN.md | 51 ++ .../math/least-common-multiple/README.md | 3 + .../least-common-multiple/README.tel-IN.md | 57 ++ src/algorithms/math/liu-hui/README.md | 3 + src/algorithms/math/liu-hui/README.tel-IN.md | 81 +++ src/algorithms/math/matrix/README.md | 3 + src/algorithms/math/matrix/README.tel-IN.md | 66 +++ src/algorithms/math/pascal-triangle/README.md | 3 + .../math/pascal-triangle/README.tel-IN.md | 57 ++ src/algorithms/math/primality-test/README.md | 3 + .../math/primality-test/README.tel-IN.md | 23 + src/algorithms/math/prime-factors/README.md | 3 +- .../math/prime-factors/README.tel-IN.md | 38 ++ .../math/prime-factors/README.zh-CN.md | 3 +- src/algorithms/math/radian/README.md | 3 + src/algorithms/math/radian/README.tel-IN.md | 39 ++ .../math/sieve-of-eratosthenes/README.md | 3 + .../sieve-of-eratosthenes/README.tel-IN.md | 34 ++ src/algorithms/math/square-root/README.md | 3 + .../math/square-root/README.tel-IN.md | 62 +++ src/algorithms/ml/k-means/README.md | 3 +- src/algorithms/ml/k-means/README.pt-BR.md | 3 +- src/algorithms/ml/k-means/README.tel-IN.md | 41 ++ src/algorithms/ml/knn/README.md | 3 +- src/algorithms/ml/knn/README.pt-BR.md | 3 +- src/algorithms/ml/knn/README.tel-IN.md | 45 ++ .../search/binary-search/README.es-ES.md | 3 +- src/algorithms/search/binary-search/README.md | 3 +- .../search/binary-search/README.pt-BR.md | 3 +- .../search/binary-search/README.tel-IN.md | 25 + .../search/interpolation-search/README.md | 3 + .../interpolation-search/README.tel-IN.md | 45 ++ src/algorithms/search/jump-search/README.md | 3 + .../search/jump-search/README.tel-IN.md | 28 + src/algorithms/search/linear-search/README.md | 3 +- .../search/linear-search/README.pt-BR.md | 3 +- .../search/linear-search/README.tel-IN.md | 22 + .../sets/cartesian-product/README.md | 3 + .../sets/cartesian-product/README.tel-IN.md | 16 + src/algorithms/sets/combination-sum/README.md | 3 + .../sets/combination-sum/README.tel-IN.md | 62 +++ src/algorithms/sets/combinations/README.md | 3 + .../sets/combinations/README.tel-IN.md | 68 +++ src/algorithms/sets/fisher-yates/README.md | 3 + .../sets/fisher-yates/README.tel-IN.md | 16 + .../sets/knapsack-problem/README.md | 3 + .../sets/knapsack-problem/README.tel-IN.md | 61 +++ .../sets/longest-common-subsequence/README.md | 3 + .../README.tel-IN.md | 25 + .../longest-increasing-subsequence/README.md | 3 + .../README.tel-IN.md | 45 ++ .../sets/maximum-subarray/README.md | 3 + .../sets/maximum-subarray/README.tel-IN.md | 30 + src/algorithms/sets/permutations/README.md | 3 + .../sets/permutations/README.tel-IN.md | 58 ++ src/algorithms/sets/power-set/README.md | 3 + .../sets/power-set/README.tel-IN.md | 110 ++++ .../shortest-common-supersequence/README.md | 3 + .../README.tel-IN.md | 26 + src/algorithms/sorting/bubble-sort/README.md | 3 +- .../sorting/bubble-sort/README.pt-BR.md | 3 +- .../sorting/bubble-sort/README.tel-IN.md | 24 + src/algorithms/sorting/bucket-sort/README.md | 3 + .../sorting/bucket-sort/README.tel-IN.md | 37 ++ .../sorting/counting-sort/README.md | 3 +- .../sorting/counting-sort/README.pt-br.md | 3 +- .../sorting/counting-sort/README.tel-IN.md | 58 ++ src/algorithms/sorting/heap-sort/README.md | 3 +- .../sorting/heap-sort/README.pt-BR.md | 3 +- .../sorting/heap-sort/README.tel-IN.md | 25 + .../sorting/insertion-sort/README.md | 3 +- .../sorting/insertion-sort/README.pt-BR.md | 3 +- .../sorting/insertion-sort/README.tel-IN.md | 23 + src/algorithms/sorting/merge-sort/README.md | 3 +- .../sorting/merge-sort/README.pt-BR.md | 3 +- .../sorting/merge-sort/README.tel-IN.md | 33 ++ src/algorithms/sorting/quick-sort/README.md | 3 +- .../sorting/quick-sort/README.pt-BR.md | 3 +- .../sorting/quick-sort/README.tel-IN.md | 36 ++ src/algorithms/sorting/radix-sort/README.md | 1 + .../sorting/radix-sort/README.pt-BR.md | 3 +- .../sorting/radix-sort/README.tel-IN.md | 45 ++ .../sorting/selection-sort/README.md | 3 +- .../sorting/selection-sort/README.pt-BR.md | 3 +- .../sorting/selection-sort/README.tel-IN.md | 25 + src/algorithms/sorting/shell-sort/README.md | 3 +- .../sorting/shell-sort/README.pt-BR.md | 3 +- .../sorting/shell-sort/README.tel-IN.md | 55 ++ .../stack/valid-parentheses/README.md | 3 + .../stack/valid-parentheses/README.tel-IN.md | 47 ++ .../statistics/weighted-random/README.md | 3 + .../weighted-random/README.tel-IN.md | 146 +++++ .../string/hamming-distance/README.md | 3 + .../string/hamming-distance/README.tel-IN.md | 23 + .../string/knuth-morris-pratt/README.md | 3 + .../knuth-morris-pratt/README.tel-IN.md | 19 + .../string/levenshtein-distance/README.md | 3 + .../levenshtein-distance/README.tel-IN.md | 103 ++++ .../string/longest-common-substring/README.md | 3 + .../longest-common-substring/README.tel-IN.md | 25 + src/algorithms/string/palindrome/README.md | 3 + .../string/palindrome/README.tel-IN.md | 31 ++ src/algorithms/string/rabin-karp/README.md | 3 + .../string/rabin-karp/README.tel-IN.md | 49 ++ .../regular-expression-matching/README.md | 3 + .../README.tel-IN.md | 74 +++ src/algorithms/string/z-algorithm/README.md | 3 + .../string/z-algorithm/README.tel-IN.md | 60 ++ .../tree/breadth-first-search/README.md | 3 + .../breadth-first-search/README.tel-IN.md | 41 ++ .../tree/depth-first-search/README.md | 3 + .../tree/depth-first-search/README.tel-IN.md | 16 + .../best-time-to-buy-sell-stocks/README.md | 3 + .../README.tel-IN.md | 110 ++++ .../uncategorized/hanoi-tower/README.md | 3 + .../hanoi-tower/README.tel-IN.md | 27 + .../uncategorized/jump-game/README.md | 3 + .../uncategorized/jump-game/README.tel-IN.md | 115 ++++ .../uncategorized/knight-tour/README.md | 3 + .../knight-tour/README.tel-IN.md | 29 + .../uncategorized/n-queens/README.md | 3 + .../uncategorized/n-queens/README.tel-IN.md | 112 ++++ .../uncategorized/rain-terraces/README.md | 3 + .../rain-terraces/README.tel-IN.md | 125 +++++ .../recursive-staircase/README.md | 3 + .../recursive-staircase/README.tel-IN.md | 24 + .../square-matrix-rotation/README.md | 3 + .../square-matrix-rotation/README.tel-IN.md | 110 ++++ .../uncategorized/unique-paths/README.md | 3 + .../unique-paths/README.tel-IN.md | 105 ++++ src/data-structures/bloom-filter/README.md | 3 +- .../bloom-filter/README.tel-IN.md | 99 ++++ src/data-structures/deque/README.md | 3 + src/data-structures/deque/README.tel-IN.md | 75 +++ src/data-structures/disjoint-set/README.md | 3 +- .../disjoint-set/README.tel-IN.md | 32 ++ .../doubly-linked-list/README.es-ES.md | 3 +- .../doubly-linked-list/README.ko-KR.md | 3 +- .../doubly-linked-list/README.md | 3 +- .../doubly-linked-list/README.tel-IN.md | 116 ++++ src/data-structures/graph/README.md | 3 +- src/data-structures/graph/README.tel-IN.md | 30 + .../hash-table/README.ko-KR.md | 3 +- src/data-structures/hash-table/README.md | 3 +- .../hash-table/README.tel-IN.md | 33 ++ src/data-structures/heap/README.md | 3 +- src/data-structures/heap/README.tel-IN.md | 66 +++ .../linked-list/README.es-ES.md | 3 +- .../linked-list/README.ko-KR.md | 3 +- src/data-structures/linked-list/README.md | 3 +- .../linked-list/README.tel-IN.md | 163 ++++++ .../linked-list/README.tr-TR.md | 1 + .../linked-list/README.vi-VN.md | 3 +- src/data-structures/lru-cache/README.md | 1 + .../lru-cache/README.tel-IN.md | 55 ++ src/data-structures/priority-queue/README.md | 3 +- .../priority-queue/README.tel-IN.md | 26 + src/data-structures/queue/README.ko-KR.md | 3 +- src/data-structures/queue/README.md | 3 +- src/data-structures/queue/README.tel-IN.md | 33 ++ src/data-structures/queue/README.vi-VN.md | 3 +- src/data-structures/stack/README.ko-KR.md | 3 +- src/data-structures/stack/README.md | 3 +- src/data-structures/stack/README.tel-IN.md | 36 ++ src/data-structures/stack/README.vi-VN.md | 3 +- src/data-structures/tree/README.md | 3 +- src/data-structures/tree/README.tel-IN.md | 32 ++ src/data-structures/tree/avl-tree/README.md | 3 +- .../tree/avl-tree/README.tel-IN.md | 48 ++ .../tree/binary-search-tree/README.md | 3 +- .../tree/binary-search-tree/README.tel-IN.md | 272 ++++++++++ .../tree/fenwick-tree/README.md | 3 +- .../tree/fenwick-tree/README.tel-IN.md | 35 ++ .../tree/red-black-tree/README.md | 3 +- .../tree/red-black-tree/README.tel-IN.md | 80 +++ .../tree/segment-tree/README.md | 3 +- .../tree/segment-tree/README.tel-IN.md | 41 ++ src/data-structures/trie/README.ko-KO.md | 3 +- src/data-structures/trie/README.md | 3 +- src/data-structures/trie/README.tel-IN.md | 28 + src/playground/README.md | 3 + src/playground/README.tel-IN.md | 13 + 291 files changed, 7592 insertions(+), 109 deletions(-) create mode 100644 README.tel-IN.md create mode 100644 src/algorithms/cryptography/caesar-cipher/README.tel-IN.md create mode 100644 src/algorithms/cryptography/hill-cipher/README.tel-IN.md create mode 100644 src/algorithms/cryptography/polynomial-hash/README.tel-IN.md create mode 100644 src/algorithms/cryptography/rail-fence-cipher/README.tel-IN.md create mode 100644 src/algorithms/graph/articulation-points/README.tel-IN.md create mode 100644 src/algorithms/graph/bellman-ford/README.tel-IN.md create mode 100644 src/algorithms/graph/breadth-first-search/README.tel-IN.md create mode 100644 src/algorithms/graph/bridges/README.tel-IN.md create mode 100644 src/algorithms/graph/depth-first-search/README.tel-IN.md create mode 100644 src/algorithms/graph/detect-cycle/README.tel-IN.md create mode 100644 src/algorithms/graph/dijkstra/README.tel-IN.md create mode 100644 src/algorithms/graph/eulerian-path/README.tel-IN.md create mode 100644 src/algorithms/graph/floyd-warshall/README.tel-IN.md create mode 100644 src/algorithms/graph/hamiltonian-cycle/README.tel-IN.md create mode 100644 src/algorithms/graph/kruskal/README.tel-IN.md create mode 100644 src/algorithms/graph/prim/README.tel-IN.md create mode 100644 src/algorithms/graph/strongly-connected-components/README.tel-IN.md create mode 100644 src/algorithms/graph/topological-sorting/README.tel-IN.md create mode 100644 src/algorithms/graph/travelling-salesman/README.tel-IN.md create mode 100644 src/algorithms/image-processing/seam-carving/README.tel-IN.md create mode 100644 src/algorithms/linked-list/reverse-traversal/README.tel-IN.md create mode 100644 src/algorithms/linked-list/traversal/README.tel-IN.md create mode 100644 src/algorithms/math/binary-floating-point/README.tel-IN.md create mode 100644 src/algorithms/math/bits/README.tel-IN.md create mode 100644 src/algorithms/math/complex-number/README.tel-IN.md create mode 100644 src/algorithms/math/euclidean-algorithm/README.tel-IN.md create mode 100644 src/algorithms/math/euclidean-distance/README.tel-IN.md create mode 100644 src/algorithms/math/factorial/README.tel-IN.md create mode 100644 src/algorithms/math/fast-powering/README.tel-IN.md create mode 100644 src/algorithms/math/fibonacci/README.tel-IN.md create mode 100644 src/algorithms/math/fourier-transform/README.tel-IN.md create mode 100644 src/algorithms/math/horner-method/README.tel-IN.md create mode 100644 src/algorithms/math/integer-partition/README.tel-IN.md create mode 100644 src/algorithms/math/is-power-of-two/README.tel-IN.md create mode 100644 src/algorithms/math/least-common-multiple/README.tel-IN.md create mode 100644 src/algorithms/math/liu-hui/README.tel-IN.md create mode 100644 src/algorithms/math/matrix/README.tel-IN.md create mode 100644 src/algorithms/math/pascal-triangle/README.tel-IN.md create mode 100644 src/algorithms/math/primality-test/README.tel-IN.md create mode 100644 src/algorithms/math/prime-factors/README.tel-IN.md create mode 100644 src/algorithms/math/radian/README.tel-IN.md create mode 100644 src/algorithms/math/sieve-of-eratosthenes/README.tel-IN.md create mode 100644 src/algorithms/math/square-root/README.tel-IN.md create mode 100644 src/algorithms/ml/k-means/README.tel-IN.md create mode 100644 src/algorithms/ml/knn/README.tel-IN.md create mode 100644 src/algorithms/search/binary-search/README.tel-IN.md create mode 100644 src/algorithms/search/interpolation-search/README.tel-IN.md create mode 100644 src/algorithms/search/jump-search/README.tel-IN.md create mode 100644 src/algorithms/search/linear-search/README.tel-IN.md create mode 100644 src/algorithms/sets/cartesian-product/README.tel-IN.md create mode 100644 src/algorithms/sets/combination-sum/README.tel-IN.md create mode 100644 src/algorithms/sets/combinations/README.tel-IN.md create mode 100644 src/algorithms/sets/fisher-yates/README.tel-IN.md create mode 100644 src/algorithms/sets/knapsack-problem/README.tel-IN.md create mode 100644 src/algorithms/sets/longest-common-subsequence/README.tel-IN.md create mode 100644 src/algorithms/sets/longest-increasing-subsequence/README.tel-IN.md create mode 100644 src/algorithms/sets/maximum-subarray/README.tel-IN.md create mode 100644 src/algorithms/sets/permutations/README.tel-IN.md create mode 100644 src/algorithms/sets/power-set/README.tel-IN.md create mode 100644 src/algorithms/sets/shortest-common-supersequence/README.tel-IN.md create mode 100644 src/algorithms/sorting/bubble-sort/README.tel-IN.md create mode 100644 src/algorithms/sorting/bucket-sort/README.tel-IN.md create mode 100644 src/algorithms/sorting/counting-sort/README.tel-IN.md create mode 100644 src/algorithms/sorting/heap-sort/README.tel-IN.md create mode 100644 src/algorithms/sorting/insertion-sort/README.tel-IN.md create mode 100644 src/algorithms/sorting/merge-sort/README.tel-IN.md create mode 100644 src/algorithms/sorting/quick-sort/README.tel-IN.md create mode 100644 src/algorithms/sorting/radix-sort/README.tel-IN.md create mode 100644 src/algorithms/sorting/selection-sort/README.tel-IN.md create mode 100644 src/algorithms/sorting/shell-sort/README.tel-IN.md create mode 100644 src/algorithms/stack/valid-parentheses/README.tel-IN.md create mode 100644 src/algorithms/statistics/weighted-random/README.tel-IN.md create mode 100644 src/algorithms/string/hamming-distance/README.tel-IN.md create mode 100644 src/algorithms/string/knuth-morris-pratt/README.tel-IN.md create mode 100644 src/algorithms/string/levenshtein-distance/README.tel-IN.md create mode 100644 src/algorithms/string/longest-common-substring/README.tel-IN.md create mode 100644 src/algorithms/string/palindrome/README.tel-IN.md create mode 100644 src/algorithms/string/rabin-karp/README.tel-IN.md create mode 100644 src/algorithms/string/regular-expression-matching/README.tel-IN.md create mode 100644 src/algorithms/string/z-algorithm/README.tel-IN.md create mode 100644 src/algorithms/tree/breadth-first-search/README.tel-IN.md create mode 100644 src/algorithms/tree/depth-first-search/README.tel-IN.md create mode 100644 src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.tel-IN.md create mode 100644 src/algorithms/uncategorized/hanoi-tower/README.tel-IN.md create mode 100644 src/algorithms/uncategorized/jump-game/README.tel-IN.md create mode 100644 src/algorithms/uncategorized/knight-tour/README.tel-IN.md create mode 100644 src/algorithms/uncategorized/n-queens/README.tel-IN.md create mode 100644 src/algorithms/uncategorized/rain-terraces/README.tel-IN.md create mode 100644 src/algorithms/uncategorized/recursive-staircase/README.tel-IN.md create mode 100644 src/algorithms/uncategorized/square-matrix-rotation/README.tel-IN.md create mode 100644 src/algorithms/uncategorized/unique-paths/README.tel-IN.md create mode 100644 src/data-structures/bloom-filter/README.tel-IN.md create mode 100644 src/data-structures/deque/README.tel-IN.md create mode 100644 src/data-structures/disjoint-set/README.tel-IN.md create mode 100644 src/data-structures/doubly-linked-list/README.tel-IN.md create mode 100644 src/data-structures/graph/README.tel-IN.md create mode 100644 src/data-structures/hash-table/README.tel-IN.md create mode 100644 src/data-structures/heap/README.tel-IN.md create mode 100644 src/data-structures/linked-list/README.tel-IN.md create mode 100644 src/data-structures/lru-cache/README.tel-IN.md create mode 100644 src/data-structures/priority-queue/README.tel-IN.md create mode 100644 src/data-structures/queue/README.tel-IN.md create mode 100644 src/data-structures/stack/README.tel-IN.md create mode 100644 src/data-structures/tree/README.tel-IN.md create mode 100644 src/data-structures/tree/avl-tree/README.tel-IN.md create mode 100644 src/data-structures/tree/binary-search-tree/README.tel-IN.md create mode 100644 src/data-structures/tree/fenwick-tree/README.tel-IN.md create mode 100644 src/data-structures/tree/red-black-tree/README.tel-IN.md create mode 100644 src/data-structures/tree/segment-tree/README.tel-IN.md create mode 100644 src/data-structures/trie/README.tel-IN.md create mode 100644 src/playground/README.tel-IN.md diff --git a/README.ar-AR.md b/README.ar-AR.md index 72ae41e73c..bca74f896c 100644 --- a/README.ar-AR.md +++ b/README.ar-AR.md @@ -25,7 +25,8 @@ _اقرأ هذا في لغات أخرى:_ [_Tiếng Việt_](README.vi-VN.md), [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) ## هياكل البيانات diff --git a/README.de-DE.md b/README.de-DE.md index 6e5be066aa..f342f66a21 100644 --- a/README.de-DE.md +++ b/README.de-DE.md @@ -26,7 +26,8 @@ _Lies dies in anderen Sprachen:_ [_Українська_](README.uk-UA.md), [_Arabic_](README.ar-AR.md), [_Uzbek_](README.uz-UZ.md) -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) ## Datenstrukturen diff --git a/README.es-ES.md b/README.es-ES.md index 8443e338b6..7c240a7773 100644 --- a/README.es-ES.md +++ b/README.es-ES.md @@ -27,7 +27,8 @@ _Léelo en otros idiomas:_ [_Tiếng Việt_](README.vi-VN.md), [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) ## Estructuras de Datos diff --git a/README.fr-FR.md b/README.fr-FR.md index cb30d1833d..dbd2c61547 100644 --- a/README.fr-FR.md +++ b/README.fr-FR.md @@ -28,7 +28,8 @@ _Lisez ceci dans d'autres langues:_ [_Tiếng Việt_](README.vi-VN.md), [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) ## Data Structures diff --git a/README.he-IL.md b/README.he-IL.md index 1d5b0904c2..0ba7951365 100644 --- a/README.he-IL.md +++ b/README.he-IL.md @@ -25,7 +25,8 @@ _קרא זאת בשפות אחרות:_ [_Arabic_](README.ar-AR.md), [_Tiếng Việt_](README.vi-VN.md), [_Deutsch_](README.de-DE.md), -[_Uzbek_](README.uz-UZ.md) +[_Uzbek_](README.uz-UZ.md), +[_తెలుగు_](README.tel-IN.md) ## מבני נתונים diff --git a/README.id-ID.md b/README.id-ID.md index ffc093d3ba..ddf0e64e68 100644 --- a/README.id-ID.md +++ b/README.id-ID.md @@ -25,7 +25,8 @@ _Baca ini dalam bahasa yang lain:_ [_Tiếng Việt_](README.vi-VN.md), [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) ## Struktur Data diff --git a/README.it-IT.md b/README.it-IT.md index 127e9adba1..8505ff19d0 100644 --- a/README.it-IT.md +++ b/README.it-IT.md @@ -24,7 +24,8 @@ _Leggilo in altre lingue:_ [_Tiếng Việt_](README.vi-VN.md), [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) ## Strutture Dati diff --git a/README.ja-JP.md b/README.ja-JP.md index acf9dee8f0..a5c7dfe558 100644 --- a/README.ja-JP.md +++ b/README.ja-JP.md @@ -27,7 +27,8 @@ _Read this in other languages:_ [_Tiếng Việt_](README.vi-VN.md), [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) ## データ構造 diff --git a/README.ko-KR.md b/README.ko-KR.md index d4b0d4ef14..2aefb29de8 100644 --- a/README.ko-KR.md +++ b/README.ko-KR.md @@ -26,7 +26,8 @@ _Read this in other languages:_ [_Tiếng Việt_](README.vi-VN.md), [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) ## 자료 구조 diff --git a/README.md b/README.md index 0eef20119a..ed8bcf4873 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,8 @@ _Read this in other languages:_ [_Tiếng Việt_](README.vi-VN.md), [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md), -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) ## Data Structures diff --git a/README.pl-PL.md b/README.pl-PL.md index 56617030ab..b7542a3425 100644 --- a/README.pl-PL.md +++ b/README.pl-PL.md @@ -28,7 +28,8 @@ _Read this in other languages:_ [_Tiếng Việt_](README.vi-VN.md), [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) ## Struktury Danych diff --git a/README.pt-BR.md b/README.pt-BR.md index 5b16798bc9..047410550e 100644 --- a/README.pt-BR.md +++ b/README.pt-BR.md @@ -28,7 +28,8 @@ _Leia isto em outros idiomas:_ [_Tiếng Việt_](README.vi-VN.md), [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) ## Estrutura de Dados diff --git a/README.ru-RU.md b/README.ru-RU.md index bdad2da9ec..f48accc6e0 100644 --- a/README.ru-RU.md +++ b/README.ru-RU.md @@ -25,7 +25,8 @@ _Читать на других языках:_ [_Tiếng Việt_](README.vi-VN.md), [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) ## Структуры данных diff --git a/README.tel-IN.md b/README.tel-IN.md new file mode 100644 index 0000000000..ad51b70515 --- /dev/null +++ b/README.tel-IN.md @@ -0,0 +1,370 @@ +# JavaScript Algorithms and Data Structures + +> 🇺🇦 ఉక్రెయిన్ మీద రష్యా ఆర్మీ [దాడి చేస్తోంది](https://war.ukraine.ua/). సామాన్య జనాలు చనిపోతున్నారు. ఇళ్ళు ఉన్న ఏరియాల మీద బాంబులు వేస్తున్నారు. +> - ఉక్రెయిన్‌కి ఇలా హెల్ప్ చేయొచ్చు: +> - [Serhiy Prytula Charity Foundation](https://prytulafoundation.org/en/) +> - [Come Back Alive Charity Foundation](https://savelife.in.ua/en/donate-en/) +> - [National Bank of Ukraine](https://bank.gov.ua/en/news/all/natsionalniy-bank-vidkriv-spetsrahunok-dlya-zboru-koshtiv-na-potrebi-armiyi) +> - ఇంకా డీటెయిల్స్ కావాలంటే [war.ukraine.ua](https://war.ukraine.ua/) ఇంకా [MFA of Ukraine](https://twitter.com/MFA_Ukraine) చూడండి + +
+ +[![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) + +ఈ repository లో బాగా పాపులర్ అయిన algorithms ఇంకా data structures కి +JavaScript లో రాసిన examples ఉన్నాయి. + +ప్రతి algorithm కి, ప్రతి data structure కి సెపరేట్ గా ఒక README ఉంది. +అందులో దాని గురించి explanation, ఇంకా ఎక్కువ చదువుకోడానికి links (YouTube వీడియోలు కూడా) ఉంటాయి. + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_简体中文_](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), +[_Italiano_](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), +[_עברית_](README.he-IL.md) + +## Data Structures + +Data structure అంటే ఏంటంటే — computer లో data ని ఒక పద్ధతిలో సర్దిపెట్టి, store చేసే విధానం. +అలా చేస్తే data ని ఫాస్ట్ గా తీసుకోవచ్చు, ఈజీగా మార్చొచ్చు. ఇంకా క్లియర్ గా చెప్పాలంటే, data structure అంటే +కొన్ని data values, వాటి మధ్య ఉండే relations, ఇంకా ఆ data మీద చేయగలిగే functions లేదా operations — ఇవన్నీ కలిపి. + +ఒక విషయం గుర్తుపెట్టుకోండి — ప్రతి data structure కి దాని ప్లస్‌లు, మైనస్‌లు ఉంటాయి. దాన్ని ఎలా implement చేయాలి అనేదానికంటే, అసలు ఆ data structure నే ఎందుకు ఎంచుకుంటున్నాం అనేదాని మీద ఎక్కువ ఫోకస్ పెట్టాలి. + +`B` - Beginner (కొత్తగా నేర్చుకునేవాళ్ళకి), `A` - Advanced (కొంచెం కష్టం) + +* `B` [Linked List](src/data-structures/linked-list) +* `B` [Doubly Linked List](src/data-structures/doubly-linked-list) +* `B` [Queue](src/data-structures/queue) +* `B` [Stack](src/data-structures/stack) +* `B` [Deque](src/data-structures/deque) - రెండు వైపుల నుంచి వాడగలిగే queue +* `B` [Hash Table](src/data-structures/hash-table) +* `B` [Heap](src/data-structures/heap) - max heap, min heap రెండూ ఉన్నాయి +* `B` [Priority Queue](src/data-structures/priority-queue) +* `A` [Trie](src/data-structures/trie) +* `A` [Tree](src/data-structures/tree) + * `A` [Binary Search Tree](src/data-structures/tree/binary-search-tree) + * `A` [AVL Tree](src/data-structures/tree/avl-tree) + * `A` [Red-Black Tree](src/data-structures/tree/red-black-tree) + * `A` [Segment Tree](src/data-structures/tree/segment-tree) - min/max/sum range queries examples తో + * `A` [Fenwick Tree](src/data-structures/tree/fenwick-tree) (Binary Indexed Tree) +* `A` [Graph](src/data-structures/graph) (directed, undirected రెండూ) +* `A` [Disjoint Set](src/data-structures/disjoint-set) - union–find data structure లేదా merge–find set +* `A` [Bloom Filter](src/data-structures/bloom-filter) +* `A` [LRU Cache](src/data-structures/lru-cache/) - Least Recently Used (LRU) cache + +## Algorithms + +Algorithm అంటే ఒక రకమైన problems ని ఎలా solve చేయాలో ఎలాంటి కన్ఫ్యూజన్ లేకుండా క్లియర్ గా చెప్పే పద్ధతి. +ఏ step తర్వాత ఏ step చేయాలో కరెక్ట్ గా చెప్పే rules సెట్ అన్నమాట. + +`B` - Beginner (కొత్తగా నేర్చుకునేవాళ్ళకి), `A` - Advanced (కొంచెం కష్టం) + +### Topic వారీగా Algorithms + +* **Math** + * `B` [Bit Manipulation](src/algorithms/math/bits) - bits ని set/get/update/clear చేయడం, రెండుతో గుణించడం/భాగించడం, negative చేయడం లాంటివి + * `B` [Binary Floating Point](src/algorithms/math/binary-floating-point) - floating-point నంబర్లని binary లో ఎలా చూపిస్తారో + * `B` [Factorial](src/algorithms/math/factorial) + * `B` [Fibonacci Number](src/algorithms/math/fibonacci) - classic, closed-form రెండు వెర్షన్లు + * `B` [Prime Factors](src/algorithms/math/prime-factors) - prime factors కనుక్కోవడం, Hardy-Ramanujan theorem తో వాటిని లెక్కపెట్టడం + * `B` [Primality Test](src/algorithms/math/primality-test) (trial division method) + * `B` [Euclidean Algorithm](src/algorithms/math/euclidean-algorithm) - Greatest Common Divisor (GCD) కనుక్కోవడం + * `B` [Least Common Multiple](src/algorithms/math/least-common-multiple) (LCM) + * `B` [Sieve of Eratosthenes](src/algorithms/math/sieve-of-eratosthenes) - ఇచ్చిన లిమిట్ వరకు ఉన్న అన్ని prime numbers కనుక్కోవడం + * `B` [Is Power of Two](src/algorithms/math/is-power-of-two) - ఒక నంబర్ రెండు యొక్క power ఆ కాదా చెక్ చేయడం (naive, bitwise algorithms) + * `B` [Pascal's Triangle](src/algorithms/math/pascal-triangle) + * `B` [Complex Number](src/algorithms/math/complex-number) - complex numbers, వాటి మీద బేసిక్ operations + * `B` [Radian & Degree](src/algorithms/math/radian) - radians ని degrees కి, degrees ని radians కి మార్చడం + * `B` [Fast Powering](src/algorithms/math/fast-powering) + * `B` [Horner's method](src/algorithms/math/horner-method) - polynomial ని evaluate చేయడం + * `B` [Matrices](src/algorithms/math/matrix) - matrices, వాటి బేసిక్ operations (multiplication, transposition లాంటివి) + * `B` [Euclidean Distance](src/algorithms/math/euclidean-distance) - రెండు points/vectors/matrices మధ్య దూరం + * `A` [Integer Partition](src/algorithms/math/integer-partition) + * `A` [Square Root](src/algorithms/math/square-root) - Newton's method + * `A` [Liu Hui π Algorithm](src/algorithms/math/liu-hui) - N-gons వాడి π ని దగ్గరదగ్గరగా లెక్కపెట్టడం + * `A` [Discrete Fourier Transform](src/algorithms/math/fourier-transform) - టైమ్ మీద ఆధారపడే ఒక function (signal) ని, దాన్ని తయారుచేసే frequencies గా విడగొట్టడం +* **Sets** + * `B` [Cartesian Product](src/algorithms/sets/cartesian-product) - చాలా sets యొక్క product + * `B` [Fisher–Yates Shuffle](src/algorithms/sets/fisher-yates) - ఒక sequence ని random గా కలిపేయడం (shuffle) + * `A` [Power Set](src/algorithms/sets/power-set) - ఒక set యొక్క అన్ని subsets (bitwise, backtracking, cascading solutions) + * `A` [Permutations](src/algorithms/sets/permutations) (repetition తో, repetition లేకుండా) + * `A` [Combinations](src/algorithms/sets/combinations) (repetition తో, repetition లేకుండా) + * `A` [Longest Common Subsequence](src/algorithms/sets/longest-common-subsequence) (LCS) + * `A` [Longest Increasing Subsequence](src/algorithms/sets/longest-increasing-subsequence) + * `A` [Shortest Common Supersequence](src/algorithms/sets/shortest-common-supersequence) (SCS) + * `A` [Knapsack Problem](src/algorithms/sets/knapsack-problem) - "0/1", "Unbound" రెండూ + * `A` [Maximum Subarray](src/algorithms/sets/maximum-subarray) - "Brute Force", "Dynamic Programming" (Kadane's) వెర్షన్లు + * `A` [Combination Sum](src/algorithms/sets/combination-sum) - ఒక specific sum వచ్చే అన్ని combinations కనుక్కోవడం +* **Strings** + * `B` [Hamming Distance](src/algorithms/string/hamming-distance) - ఎన్ని positions లో symbols వేరువేరుగా ఉన్నాయో లెక్కపెట్టడం + * `B` [Palindrome](src/algorithms/string/palindrome) - string ని తిరగేసి చదివినా అదే వస్తుందా చెక్ చేయడం + * `A` [Levenshtein Distance](src/algorithms/string/levenshtein-distance) - రెండు sequences మధ్య minimum edit distance + * `A` [Knuth–Morris–Pratt Algorithm](src/algorithms/string/knuth-morris-pratt) (KMP Algorithm) - substring search (pattern matching) + * `A` [Z Algorithm](src/algorithms/string/z-algorithm) - substring search (pattern matching) + * `A` [Rabin Karp Algorithm](src/algorithms/string/rabin-karp) - substring search + * `A` [Longest Common Substring](src/algorithms/string/longest-common-substring) + * `A` [Regular Expression Matching](src/algorithms/string/regular-expression-matching) +* **Searches** + * `B` [Linear Search](src/algorithms/search/linear-search) + * `B` [Jump Search](src/algorithms/search/jump-search) (లేదా Block Search) - sort అయిన array లో search + * `B` [Binary Search](src/algorithms/search/binary-search) - sort అయిన array లో search + * `B` [Interpolation Search](src/algorithms/search/interpolation-search) - సమానంగా పంచబడిన (uniformly distributed) sorted array లో search +* **Sorting** + * `B` [Bubble Sort](src/algorithms/sorting/bubble-sort) + * `B` [Selection Sort](src/algorithms/sorting/selection-sort) + * `B` [Insertion Sort](src/algorithms/sorting/insertion-sort) + * `B` [Heap Sort](src/algorithms/sorting/heap-sort) + * `B` [Merge Sort](src/algorithms/sorting/merge-sort) + * `B` [Quicksort](src/algorithms/sorting/quick-sort) - in-place, non-in-place రెండు implementations + * `B` [Shellsort](src/algorithms/sorting/shell-sort) + * `B` [Counting Sort](src/algorithms/sorting/counting-sort) + * `B` [Radix Sort](src/algorithms/sorting/radix-sort) + * `B` [Bucket Sort](src/algorithms/sorting/bucket-sort) +* **Linked Lists** + * `B` [Straight Traversal](src/algorithms/linked-list/traversal) + * `B` [Reverse Traversal](src/algorithms/linked-list/reverse-traversal) +* **Trees** + * `B` [Depth-First Search](src/algorithms/tree/depth-first-search) (DFS) + * `B` [Breadth-First Search](src/algorithms/tree/breadth-first-search) (BFS) +* **Graphs** + * `B` [Depth-First Search](src/algorithms/graph/depth-first-search) (DFS) + * `B` [Breadth-First Search](src/algorithms/graph/breadth-first-search) (BFS) + * `B` [Kruskal’s Algorithm](src/algorithms/graph/kruskal) - weighted undirected graph కి Minimum Spanning Tree (MST) కనుక్కోవడం + * `A` [Dijkstra Algorithm](src/algorithms/graph/dijkstra) - ఒక vertex నుంచి graph లో ఉన్న అన్ని vertices కి shortest paths కనుక్కోవడం + * `A` [Bellman-Ford Algorithm](src/algorithms/graph/bellman-ford) - ఒక vertex నుంచి graph లో ఉన్న అన్ని vertices కి shortest paths కనుక్కోవడం + * `A` [Floyd-Warshall Algorithm](src/algorithms/graph/floyd-warshall) - ప్రతి జత vertices మధ్య shortest paths కనుక్కోవడం + * `A` [Detect Cycle](src/algorithms/graph/detect-cycle) - directed, undirected graphs రెండిట్లో cycle ఉందా చూడటం (DFS, Disjoint Set వెర్షన్లు) + * `A` [Prim’s Algorithm](src/algorithms/graph/prim) - weighted undirected graph కి Minimum Spanning Tree (MST) కనుక్కోవడం + * `A` [Topological Sorting](src/algorithms/graph/topological-sorting) - DFS method + * `A` [Articulation Points](src/algorithms/graph/articulation-points) - Tarjan's algorithm (DFS మీద బేస్ అయింది) + * `A` [Bridges](src/algorithms/graph/bridges) - DFS మీద బేస్ అయిన algorithm + * `A` [Eulerian Path and Eulerian Circuit](src/algorithms/graph/eulerian-path) - Fleury's algorithm - ప్రతి edge ని సరిగ్గా ఒక్కసారే visit చేయడం + * `A` [Hamiltonian Cycle](src/algorithms/graph/hamiltonian-cycle) - ప్రతి vertex ని సరిగ్గా ఒక్కసారే visit చేయడం + * `A` [Strongly Connected Components](src/algorithms/graph/strongly-connected-components) - Kosaraju's algorithm + * `A` [Travelling Salesman Problem](src/algorithms/graph/travelling-salesman) - ప్రతి సిటీకి ఒక్కసారి వెళ్ళి, మళ్ళీ మొదలుపెట్టిన సిటీకి తిరిగొచ్చే అతి చిన్న route +* **Cryptography** + * `B` [Polynomial Hash](src/algorithms/cryptography/polynomial-hash) - polynomial మీద బేస్ అయిన rolling hash function + * `B` [Rail Fence Cipher](src/algorithms/cryptography/rail-fence-cipher) - messages ని encode చేయడానికి వాడే transposition cipher algorithm + * `B` [Caesar Cipher](src/algorithms/cryptography/caesar-cipher) - సింపుల్ substitution cipher + * `B` [Hill Cipher](src/algorithms/cryptography/hill-cipher) - linear algebra మీద బేస్ అయిన substitution cipher +* **Machine Learning** + * `B` [NanoNeuron](https://github.com/trekhleb/nano-neuron) - machines అసలు ఎలా నేర్చుకుంటాయో చూపించే 7 సింపుల్ JS functions (forward/backward propagation) + * `B` [k-NN](src/algorithms/ml/knn) - k-nearest neighbors classification algorithm + * `B` [k-Means](src/algorithms/ml/k-means) - k-Means clustering algorithm +* **Image Processing** + * `B` [Seam Carving](src/algorithms/image-processing/seam-carving) - image లో ముఖ్యమైన content పాడవకుండా సైజ్ మార్చే algorithm +* **Statistics** + * `B` [Weighted Random](src/algorithms/statistics/weighted-random) - list లో ఉన్న items వాటి weights ని బట్టి random గా ఒకటి ఎంచుకోవడం +* **Evolutionary algorithms** + * `A` [Genetic algorithm](https://github.com/trekhleb/self-parking-car-evolution) - self-parking cars ని train చేయడానికి genetic algorithm ని ఎలా వాడొచ్చో చూపించే example +* **Uncategorized (ఇతరాలు)** + * `B` [Tower of Hanoi](src/algorithms/uncategorized/hanoi-tower) + * `B` [Square Matrix Rotation](src/algorithms/uncategorized/square-matrix-rotation) - in-place algorithm + * `B` [Jump Game](src/algorithms/uncategorized/jump-game) - backtracking, dynamic programming (top-down + bottom-up), greedy examples + * `B` [Unique Paths](src/algorithms/uncategorized/unique-paths) - backtracking, dynamic programming, Pascal's Triangle మీద బేస్ అయిన examples + * `B` [Rain Terraces](src/algorithms/uncategorized/rain-terraces) - వర్షం నీళ్ళు ఎంత నిలుస్తాయో కనుక్కునే problem (dynamic programming, brute force వెర్షన్లు) + * `B` [Recursive Staircase](src/algorithms/uncategorized/recursive-staircase) - పైకి చేరడానికి ఎన్ని రకాలుగా వెళ్ళొచ్చో లెక్కపెట్టడం (4 solutions) + * `B` [Best Time To Buy Sell Stocks](src/algorithms/uncategorized/best-time-to-buy-sell-stocks) - divide and conquer, one-pass examples + * `B` [Valid Parentheses](src/algorithms/stack/valid-parentheses) - ఒక string లో brackets కరెక్ట్ గా ఉన్నాయా చెక్ చేయడం (stack వాడి) + * `A` [N-Queens Problem](src/algorithms/uncategorized/n-queens) + * `A` [Knight's Tour](src/algorithms/uncategorized/knight-tour) + +### Paradigm వారీగా Algorithms + +Algorithmic paradigm అంటే ఒక రకమైన algorithms అన్నీ డిజైన్ చేయడానికి వాడే జనరల్ పద్ధతి లేదా approach. +Computer program కంటే algorithm ఒక లెవెల్ పైన ఉన్న ఐడియా ఎలాగో, algorithm కంటే paradigm ఇంకో లెవెల్ పైన ఉన్న ఐడియా అన్నమాట. + +* **Brute Force** - ఉన్న అన్ని possibilities చూసి, వాటిలో బెస్ట్ solution ఎంచుకోవడం + * `B` [Linear Search](src/algorithms/search/linear-search) + * `B` [Rain Terraces](src/algorithms/uncategorized/rain-terraces) - వర్షం నీళ్ళు ఎంత నిలుస్తాయో కనుక్కునే problem + * `B` [Recursive Staircase](src/algorithms/uncategorized/recursive-staircase) - పైకి చేరడానికి ఎన్ని రకాలుగా వెళ్ళొచ్చో లెక్కపెట్టడం + * `A` [Maximum Subarray](src/algorithms/sets/maximum-subarray) + * `A` [Travelling Salesman Problem](src/algorithms/graph/travelling-salesman) - ప్రతి సిటీకి ఒక్కసారి వెళ్ళి, మళ్ళీ మొదలుపెట్టిన సిటీకి తిరిగొచ్చే అతి చిన్న route + * `A` [Discrete Fourier Transform](src/algorithms/math/fourier-transform) - టైమ్ మీద ఆధారపడే ఒక function (signal) ని, దాన్ని తయారుచేసే frequencies గా విడగొట్టడం +* **Greedy** - భవిష్యత్తు గురించి ఆలోచించకుండా, ఆ టైమ్ కి ఏది బెస్ట్ అనిపిస్తే అది ఎంచుకోవడం + * `B` [Jump Game](src/algorithms/uncategorized/jump-game) + * `A` [Unbound Knapsack Problem](src/algorithms/sets/knapsack-problem) + * `A` [Dijkstra Algorithm](src/algorithms/graph/dijkstra) - graph లో అన్ని vertices కి shortest path కనుక్కోవడం + * `A` [Prim’s Algorithm](src/algorithms/graph/prim) - weighted undirected graph కి Minimum Spanning Tree (MST) కనుక్కోవడం + * `A` [Kruskal’s Algorithm](src/algorithms/graph/kruskal) - weighted undirected graph కి Minimum Spanning Tree (MST) కనుక్కోవడం +* **Divide and Conquer** - problem ని చిన్న చిన్న ముక్కలుగా విడగొట్టి, ఆ ముక్కల్ని solve చేయడం + * `B` [Binary Search](src/algorithms/search/binary-search) + * `B` [Tower of Hanoi](src/algorithms/uncategorized/hanoi-tower) + * `B` [Pascal's Triangle](src/algorithms/math/pascal-triangle) + * `B` [Euclidean Algorithm](src/algorithms/math/euclidean-algorithm) - Greatest Common Divisor (GCD) కనుక్కోవడం + * `B` [Merge Sort](src/algorithms/sorting/merge-sort) + * `B` [Quicksort](src/algorithms/sorting/quick-sort) + * `B` [Tree Depth-First Search](src/algorithms/tree/depth-first-search) (DFS) + * `B` [Graph Depth-First Search](src/algorithms/graph/depth-first-search) (DFS) + * `B` [Matrices](src/algorithms/math/matrix) - వేరువేరు shapes ఉన్న matrices ని తయారుచేయడం, traverse చేయడం + * `B` [Jump Game](src/algorithms/uncategorized/jump-game) + * `B` [Fast Powering](src/algorithms/math/fast-powering) + * `B` [Best Time To Buy Sell Stocks](src/algorithms/uncategorized/best-time-to-buy-sell-stocks) - divide and conquer, one-pass examples + * `A` [Permutations](src/algorithms/sets/permutations) (repetition తో, repetition లేకుండా) + * `A` [Combinations](src/algorithms/sets/combinations) (repetition తో, repetition లేకుండా) + * `A` [Maximum Subarray](src/algorithms/sets/maximum-subarray) +* **Dynamic Programming** - ఇంతకుముందే కనుక్కున్న చిన్న solutions ని వాడుకుంటూ పెద్ద solution ని కట్టడం + * `B` [Fibonacci Number](src/algorithms/math/fibonacci) + * `B` [Jump Game](src/algorithms/uncategorized/jump-game) + * `B` [Unique Paths](src/algorithms/uncategorized/unique-paths) + * `B` [Rain Terraces](src/algorithms/uncategorized/rain-terraces) - వర్షం నీళ్ళు ఎంత నిలుస్తాయో కనుక్కునే problem + * `B` [Recursive Staircase](src/algorithms/uncategorized/recursive-staircase) - పైకి చేరడానికి ఎన్ని రకాలుగా వెళ్ళొచ్చో లెక్కపెట్టడం + * `B` [Seam Carving](src/algorithms/image-processing/seam-carving) - image లో ముఖ్యమైన content పాడవకుండా సైజ్ మార్చే algorithm + * `A` [Levenshtein Distance](src/algorithms/string/levenshtein-distance) - రెండు sequences మధ్య minimum edit distance + * `A` [Longest Common Subsequence](src/algorithms/sets/longest-common-subsequence) (LCS) + * `A` [Longest Common Substring](src/algorithms/string/longest-common-substring) + * `A` [Longest Increasing Subsequence](src/algorithms/sets/longest-increasing-subsequence) + * `A` [Shortest Common Supersequence](src/algorithms/sets/shortest-common-supersequence) + * `A` [0/1 Knapsack Problem](src/algorithms/sets/knapsack-problem) + * `A` [Integer Partition](src/algorithms/math/integer-partition) + * `A` [Maximum Subarray](src/algorithms/sets/maximum-subarray) + * `A` [Bellman-Ford Algorithm](src/algorithms/graph/bellman-ford) - graph లో అన్ని vertices కి shortest path కనుక్కోవడం + * `A` [Floyd-Warshall Algorithm](src/algorithms/graph/floyd-warshall) - ప్రతి జత vertices మధ్య shortest paths కనుక్కోవడం + * `A` [Regular Expression Matching](src/algorithms/string/regular-expression-matching) +* **Backtracking** - brute force లాగానే అన్ని possible solutions తయారుచేయడానికి ట్రై చేస్తాం, కానీ ప్రతిసారి next solution తయారుచేసినప్పుడు +అది అన్ని conditions కి సరిపోతుందా అని చెక్ చేస్తాం. సరిపోతేనే ముందుకు వెళ్తాం. లేకపోతే వెనక్కి వచ్చి (backtrack చేసి) +వేరే దారిలో solution కోసం వెతుకుతాం. మామూలుగా state-space మీద DFS traversal వాడతారు. + * `B` [Jump Game](src/algorithms/uncategorized/jump-game) + * `B` [Unique Paths](src/algorithms/uncategorized/unique-paths) + * `B` [Power Set](src/algorithms/sets/power-set) - ఒక set యొక్క అన్ని subsets + * `A` [Hamiltonian Cycle](src/algorithms/graph/hamiltonian-cycle) - ప్రతి vertex ని సరిగ్గా ఒక్కసారే visit చేయడం + * `A` [N-Queens Problem](src/algorithms/uncategorized/n-queens) + * `A` [Knight's Tour](src/algorithms/uncategorized/knight-tour) + * `A` [Combination Sum](src/algorithms/sets/combination-sum) - ఒక specific sum వచ్చే అన్ని combinations కనుక్కోవడం +* **Branch & Bound** - backtracking search లో ప్రతి stage లో దొరికిన అతి తక్కువ cost ఉన్న solution ని గుర్తుపెట్టుకుంటాం. +ఇప్పటివరకు దొరికిన ఆ తక్కువ cost ని ఒక lower bound లాగా వాడి, దానికంటే ఎక్కువ cost ఉన్న partial solutions ని +పక్కన పడేస్తాం. మామూలుగా state-space tree మీద BFS traversal, DFS traversal రెండూ కలిపి వాడతారు. + +## ఈ repository ని ఎలా వాడాలి + +**అన్ని dependencies install చేయడానికి** + +``` +npm install +``` + +**ESLint రన్ చేయడానికి** + +Code quality ఎలా ఉందో చెక్ చేసుకోవాలంటే ఇది రన్ చేయొచ్చు. + +``` +npm run lint +``` + +**అన్ని tests రన్ చేయడానికి** + +``` +npm test +``` + +**పేరు ఇచ్చి tests రన్ చేయడానికి** + +``` +npm test -- 'LinkedList' +``` + +**ఏమైనా ప్రాబ్లమ్ వస్తే (Troubleshooting)** + +Linting గానీ testing గానీ fail అవుతుంటే, `node_modules` folder ని డిలీట్ చేసి npm packages మళ్ళీ install చేసి చూడండి: + +``` +rm -rf ./node_modules +npm i +``` + +ఇంకా, మీరు కరెక్ట్ Node version (`>=16`) వాడుతున్నారో లేదో చూసుకోండి. Node version manage చేయడానికి [nvm](https://github.com/nvm-sh/nvm) వాడుతుంటే, project root folder లో `nvm use` రన్ చేస్తే చాలు, కరెక్ట్ version ఆటోమేటిక్ గా తీసుకుంటుంది. + +**Playground** + +Data structures, algorithms తో ఆడుకోవాలంటే `./src/playground/playground.js` file లో కోడ్ రాసుకోవచ్చు, +దానికి tests `./src/playground/__test__/playground.test.js` లో రాసుకోవచ్చు. + +తర్వాత మీ playground కోడ్ అనుకున్నట్టు పనిచేస్తుందో లేదో చూడటానికి ఈ command రన్ చేస్తే సరిపోతుంది: + +``` +npm test -- 'playground' +``` + +## ఉపయోగపడే సమాచారం + +### References + +- [▶ YouTube లో Data Structures and Algorithms](https://www.youtube.com/playlist?list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) +- [✍🏻 Data Structure Sketches](https://okso.app/showcase/data-structures) + +### Big O Notation + +Input సైజ్ పెరిగే కొద్దీ ఒక algorithm కి పట్టే టైమ్ గానీ, కావాల్సిన memory (space) గానీ ఎంత పెరుగుతుందో దాన్ని బట్టి algorithms ని వర్గీకరించడానికి *Big O notation* వాడతారు. +కింద ఉన్న chart లో, Big O notation లో ఎక్కువగా కనిపించే growth orders చూడొచ్చు. + +![Big O graphs](./assets/big-o-graph.png) + +Source: [Big O Cheat Sheet](http://bigocheatsheet.com/). + +కింద ఎక్కువగా వాడే కొన్ని Big O notations, వేరువేరు input సైజ్‌లకి అవి ఎంత performance ఇస్తాయో comparison ఉంది. + +| Big O Notation | రకం | 10 elements కి computations | 100 elements కి computations | 1000 elements కి computations | +| -------------- | ----------- | ---------------------------- | ----------------------------- | ------------------------------- | +| **O(1)** | Constant | 1 | 1 | 1 | +| **O(log N)** | Logarithmic | 3 | 6 | 9 | +| **O(N)** | Linear | 10 | 100 | 1000 | +| **O(N log N)** | n log(n) | 30 | 600 | 9000 | +| **O(N^2)** | Quadratic | 100 | 10000 | 1000000 | +| **O(2^N)** | Exponential | 1024 | 1.26e+29 | 1.07e+301 | +| **O(N!)** | Factorial | 3628800 | 9.3e+157 | 4.02e+2567 | + +### Data Structure Operations Complexity + +| Data Structure | Access | Search | Insertion | Deletion | Comments | +| ----------------------- | :-------: | :-------: | :-------: | :-------: | :-------- | +| **Array** | 1 | n | n | n | | +| **Stack** | n | n | 1 | 1 | | +| **Queue** | n | n | 1 | 1 | | +| **Linked List** | n | n | 1 | n | | +| **Hash Table** | - | n | n | n | Perfect hash function ఉంటే cost O(1) అవుతుంది | +| **Binary Search Tree** | n | n | n | n | Tree balanced గా ఉంటే cost O(log(n)) అవుతుంది | +| **B-Tree** | log(n) | log(n) | log(n) | log(n) | | +| **Red-Black Tree** | log(n) | log(n) | log(n) | log(n) | | +| **AVL Tree** | log(n) | log(n) | log(n) | log(n) | | +| **Bloom Filter** | - | 1 | 1 | - | Search చేసేటప్పుడు false positives రావొచ్చు | + +### Array Sorting Algorithms Complexity + +| పేరు | Best | Average | Worst | Memory | Stable | Comments | +| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- | +| **Bubble sort** | n | n2 | n2 | 1 | అవును | | +| **Insertion sort** | n | n2 | n2 | 1 | అవును | | +| **Selection sort** | n2 | n2 | n2 | 1 | కాదు | | +| **Heap sort** | n log(n) | n log(n) | n log(n) | 1 | కాదు | | +| **Merge sort** | n log(n) | n log(n) | n log(n) | n | అవును | | +| **Quick sort** | n log(n) | n log(n) | n2 | log(n) | కాదు | Quicksort ని మామూలుగా in-place గా, O(log(n)) stack space తో చేస్తారు | +| **Shell sort** | n log(n) | gap sequence ని బట్టి మారుతుంది | n (log(n))2 | 1 | కాదు | | +| **Counting sort** | n + r | n + r | n + r | n + r | అవును | r - array లో ఉన్న అతి పెద్ద నంబర్ | +| **Radix sort** | n * k | n * k | n * k | n + k | అవును | k - అతి పొడవైన key యొక్క length | + +## Author + +[@trekhleb](https://trekhleb.dev) + +JavaScript, algorithms గురించి ఇంకొన్ని [projects](https://trekhleb.dev/projects/), [articles](https://trekhleb.dev/blog/) [trekhleb.dev](https://trekhleb.dev) లో ఉన్నాయి: + +- 🧠 [yesbrainer.ai](https://yesbrainer.ai/) – అంత ఈజీ కాని decisions తీసుకోడానికి AI models కౌన్సిల్ (BYOK, private, account అక్కర్లేదు) +- ✍🏻 [okso.app](https://okso.app/) – మీ ఆలోచనలు, ఐడియాలని బొమ్మల రూపంలో చెప్పడానికి, అర్థం చేసుకోడానికి, సర్దుకోడానికి ఒక drawing app diff --git a/README.tr-TR.md b/README.tr-TR.md index 368baeea91..4f0e7be0f9 100644 --- a/README.tr-TR.md +++ b/README.tr-TR.md @@ -25,7 +25,8 @@ _Read this in other languages:_ [_Tiếng Việt_](README.vi-VN.md), [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) ## Veri Yapıları diff --git a/README.uk-UA.md b/README.uk-UA.md index a32e2390da..3d6456fb3d 100644 --- a/README.uk-UA.md +++ b/README.uk-UA.md @@ -25,7 +25,8 @@ _Вивчення матеріалу на інших мовах:_ [_Tiếng Việt_](README.vi-VN.md), [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) ## Структури даних diff --git a/README.uz-UZ.md b/README.uz-UZ.md index f951f1e494..6942ada7c5 100644 --- a/README.uz-UZ.md +++ b/README.uz-UZ.md @@ -29,7 +29,8 @@ _Read this in other languages:_ [_Tiếng Việt_](README.vi-VN.md), [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) ## Ma'lumotlar tuzilmalari diff --git a/README.vi-VN.md b/README.vi-VN.md index b879955866..811fcfe072 100644 --- a/README.vi-VN.md +++ b/README.vi-VN.md @@ -25,7 +25,8 @@ _Đọc bằng ngôn ngữ khác:_ [_Bahasa Indonesia_](README.id-ID.md), [_Українська_](README.uk-UA.md), [_Arabic_](README.ar-AR.md) -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) ## Cấu Trúc Dữ Liệu diff --git a/README.zh-CN.md b/README.zh-CN.md index f31359eccb..a81c92161e 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -25,7 +25,8 @@ _Read this in other languages:_ [_Tiếng Việt_](README.vi-VN.md), [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) ## 数据结构 diff --git a/README.zh-TW.md b/README.zh-TW.md index aa48b40bd8..0c6c417756 100644 --- a/README.zh-TW.md +++ b/README.zh-TW.md @@ -24,7 +24,8 @@ _Read this in other languages:_ [_Tiếng Việt_](README.vi-VN.md), [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) ## 資料結構 diff --git a/src/algorithms/cryptography/caesar-cipher/README.md b/src/algorithms/cryptography/caesar-cipher/README.md index d648a62ee9..dd69cb3c1a 100644 --- a/src/algorithms/cryptography/caesar-cipher/README.md +++ b/src/algorithms/cryptography/caesar-cipher/README.md @@ -1,7 +1,8 @@ # Caesar Cipher Algorithm _Read this in other languages:_ -[_Русский_](README.ru-RU.md) +[_Русский_](README.ru-RU.md), +[_తెలుగు_](README.tel-IN.md) In cryptography, a **Caesar cipher**, also known as **Caesar's cipher**, the **shift cipher**, **Caesar's code** or **Caesar shift**, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of `3`, `D` would be replaced by `A`, `E` would become `B`, and so on. The method is named after Julius Caesar, who used it in his private correspondence. diff --git a/src/algorithms/cryptography/caesar-cipher/README.tel-IN.md b/src/algorithms/cryptography/caesar-cipher/README.tel-IN.md new file mode 100644 index 0000000000..128a009d9b --- /dev/null +++ b/src/algorithms/cryptography/caesar-cipher/README.tel-IN.md @@ -0,0 +1,34 @@ +# Caesar Cipher Algorithm + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Русский_](README.ru-RU.md) + +Cryptography లో **Caesar cipher** (దీన్నే **Caesar's cipher**, **shift cipher**, **Caesar's code** లేదా **Caesar shift** అని కూడా అంటారు) అనేది అన్నిటికంటే సింపుల్ గా ఉండే, అందరికీ బాగా తెలిసిన encryption techniques లో ఒకటి. ఇది ఒక రకమైన substitution cipher — అంటే plaintext లో ఉన్న ప్రతి letter ని, alphabet లో ఒక fixed నంబర్ positions ముందుకు/వెనక్కి ఉన్న వేరే letter తో మార్చేస్తాం. ఉదాహరణకి, left shift `3` అనుకుంటే, `D` బదులు `A` వస్తుంది, `E` బదులు `B` వస్తుంది, అలా అన్నమాట. Julius Caesar తన పర్సనల్ లెటర్స్ లో ఈ పద్ధతి వాడేవాడు, అందుకే దీనికి ఆ పేరు వచ్చింది. + +![Caesar Cipher Algorithm](https://upload.wikimedia.org/wikipedia/commons/4/4a/Caesar_cipher_left_shift_of_3.svg) + +## Example + +రెండు alphabets ని పక్కపక్కన పెట్టి ఈ మార్పుని చూపించొచ్చు — cipher alphabet అంటే మామూలు alphabet నే కొన్ని positions ఎడమకి గానీ కుడికి గానీ తిప్పితే వచ్చేది. ఉదాహరణకి, ఇక్కడ మూడు places left rotation తో Caesar cipher ఉంది. ఇది right shift 23 తో సమానం (ఈ shift నంబర్ నే key గా వాడతాం): + +```text +Plain: ABCDEFGHIJKLMNOPQRSTUVWXYZ +Cipher: XYZABCDEFGHIJKLMNOPQRSTUVW +``` + +Encrypt చేసేటప్పుడు, message లో ప్రతి letter ని "plain" line లో వెతికి, దాని కింద "cipher" line లో ఉన్న letter ని రాసుకుంటాం. + +```text +Plaintext: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG +Ciphertext: QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD +``` + +## Complexity + +- Time: `O(|n|)` +- Space: `O(|n|)` + +## References + +- [Wikipedia లో Caesar cipher](https://en.wikipedia.org/wiki/Caesar_cipher) diff --git a/src/algorithms/cryptography/hill-cipher/README.md b/src/algorithms/cryptography/hill-cipher/README.md index bf496e2be9..ba2cdadce2 100644 --- a/src/algorithms/cryptography/hill-cipher/README.md +++ b/src/algorithms/cryptography/hill-cipher/README.md @@ -1,5 +1,8 @@ # Hill Cipher +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + The **Hill cipher** is a [polygraphic substitution](https://en.wikipedia.org/wiki/Polygraphic_substitution) cipher based on linear algebra. Each letter is represented by a number [modulo](https://en.wikipedia.org/wiki/Modular_arithmetic) `26`. Though this is not an essential feature of the cipher, this simple scheme is often used: diff --git a/src/algorithms/cryptography/hill-cipher/README.tel-IN.md b/src/algorithms/cryptography/hill-cipher/README.tel-IN.md new file mode 100644 index 0000000000..e2efca6200 --- /dev/null +++ b/src/algorithms/cryptography/hill-cipher/README.tel-IN.md @@ -0,0 +1,98 @@ +# Hill Cipher + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +**Hill cipher** అనేది linear algebra మీద బేస్ అయిన ఒక [polygraphic substitution](https://en.wikipedia.org/wiki/Polygraphic_substitution) cipher. + +ప్రతి letter ని [modulo](https://en.wikipedia.org/wiki/Modular_arithmetic) `26` లో ఒక నంబర్ గా చూపిస్తాం. ఈ cipher కి ఇది తప్పనిసరి కాదు కానీ, మామూలుగా ఈ సింపుల్ పద్ధతే వాడతారు: + +| **Letter** | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | +| ------ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| **Number** | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | + +## Encryption + +ఒక message ని encrypt చేయడానికి, ప్రతి `n` letters block ని (దాన్ని `n` components ఉన్న ఒక vector లాగా చూస్తాం) ఒక invertible `n × n` matrix తో, modulus `26` లో గుణిస్తాం. + +Encryption కి వాడే ఈ matrix నే _cipher key_ అంటారు. దీన్ని invertible `n × n` matrices (modulo `26`) లో నుంచి random గా ఎంచుకోవాలి. ఎన్ని letters ఉన్న alphabet కైనా ఈ cipher ని మార్చి వాడుకోవచ్చు — లెక్కలన్నీ modulo `26` బదులు modulo (letters సంఖ్య) లో చేస్తే చాలు. + +`ACT` అనే message, ఇంకా కింద ఉన్న key (letters లో అయితే `GYB/NQK/URP`) తీసుకుందాం: + +``` +| 6 24 1 | +| 13 16 10 | +| 20 17 15 | +``` + +`A` అంటే `0`, `C` అంటే `2`, `T` అంటే `19` కాబట్టి, message ఈ vector అవుతుంది: + +``` +| 0 | +| 2 | +| 19 | +``` + +అంటే, encrypt అయిన vector ఇలా వస్తుంది: + +``` +| 6 24 1 | | 0 | | 67 | | 15 | +| 13 16 10 | | 2 | = | 222 | ≡ | 14 | (mod 26) +| 20 17 15 | | 19 | | 319 | | 7 | +``` + +దీనికి సరిపోయే ciphertext `POH`. + +ఇప్పుడు మన message `CAT` అనుకుందాం (`ACT` లో ఉన్న letters నే వాడుతున్నాం, గమనించండి), అంటే: + +``` +| 2 | +| 0 | +| 19 | +``` + +ఈసారి encrypt అయిన vector: + +``` +| 6 24 1 | | 2 | | 31 | | 5 | +| 13 16 10 | | 0 | = | 216 | ≡ | 8 | (mod 26) +| 20 17 15 | | 19 | | 325 | | 13 | +``` + +దీనికి సరిపోయే ciphertext `FIN`. చూశారా, ప్రతి letter మారిపోయింది. + +## Decryption + +Message ని decrypt చేయడానికి, ప్రతి block ని encryption కి వాడిన matrix యొక్క inverse తో గుణిస్తాం. ciphertext ని మళ్ళీ vector గా మార్చి, key matrix యొక్క inverse matrix (letters లో `IFK/VIV/VMI`) తో గుణిస్తే సరిపోతుంది. (Inverse matrix ఎలా కనుక్కోవాలో తెలియాలంటే [matrix inversion](https://en.wikipedia.org/wiki/Matrix_inversion) చూడండి.) పైన example లో వాడిన matrix కి modulo 26 లో inverse ఇది: + +``` + -1 +| 6 24 1 | | 8 5 10 | +| 13 16 10 | (mod 26) ≡ | 21 8 21 | +| 20 17 15 | | 21 12 8 | +``` + +పైన వచ్చిన ciphertext `POH` తీసుకుంటే: + +``` +| 8 5 10 | | 15 | | 260 | | 0 | +| 21 8 21 | | 14 | = | 574 | ≡ | 2 | (mod 26) +| 21 12 8 | | 7 | | 539 | | 19 | +``` + +అనుకున్నట్టే మళ్ళీ `ACT` వచ్చేసింది. + +## Encrypt చేసే matrix ని ఎలా ఎంచుకోవాలి + +Encrypt చేసే matrix ని ఎంచుకునేటప్పుడు రెండు చిక్కులు ఉంటాయి: + +1. అన్ని matrices కి inverse ఉండదు. Matrix యొక్క [determinant](https://en.wikipedia.org/wiki/Determinant) zero కాకపోతేనే దానికి inverse ఉంటుంది. +2. Encrypt చేసే matrix యొక్క determinant కి, modular base కి common factors ఏమీ ఉండకూడదు. + +అంటే పైన లాగా modulo `26` లో పని చేస్తుంటే, determinant zero కాకూడదు, ఇంకా `2` తో గానీ `13` తో గానీ భాగించబడకూడదు. Determinant `0` అయినా, లేదా modular base తో common factors ఉన్నా, ఆ matrix ని Hill cipher లో వాడలేం — వేరే matrix ఎంచుకోవాలి (లేకపోతే decrypt చేయడం కుదరదు). అదృష్టం ఏంటంటే, Hill cipher కి కావాల్సిన conditions కి సరిపోయే matrices చాలానే దొరుకుతాయి. + +## References + +- [Wikipedia లో Hill cipher](https://en.wikipedia.org/wiki/Hill_cipher) +- [MathIsFun లో Matrix inversion](https://www.mathsisfun.com/algebra/matrix-inverse.html) +- [GeeksForGeeks](https://www.geeksforgeeks.org/hill-cipher/) diff --git a/src/algorithms/cryptography/polynomial-hash/README.md b/src/algorithms/cryptography/polynomial-hash/README.md index 5c8a4097cb..21cd01a776 100644 --- a/src/algorithms/cryptography/polynomial-hash/README.md +++ b/src/algorithms/cryptography/polynomial-hash/README.md @@ -1,5 +1,8 @@ # Polynomial Rolling Hash +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + ## Hash Function **Hash functions** are used to map large data sets of elements of an arbitrary diff --git a/src/algorithms/cryptography/polynomial-hash/README.tel-IN.md b/src/algorithms/cryptography/polynomial-hash/README.tel-IN.md new file mode 100644 index 0000000000..9ee6182cbb --- /dev/null +++ b/src/algorithms/cryptography/polynomial-hash/README.tel-IN.md @@ -0,0 +1,112 @@ +# Polynomial Rolling Hash + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +## Hash Function + +ఎంత పొడవైనా ఉండే elements (*keys*) ఉన్న పెద్ద data sets ని, ఒక fixed length ఉండే +elements (*fingerprints*) ఉన్న చిన్న data sets కి map చేయడానికి **hash functions** వాడతారు. + +Hashing యొక్క బేసిక్ ఉపయోగం ఏంటంటే — రెండు keys సమానమా కాదా అని, వాటి fingerprints ని +compare చేసి ఫాస్ట్ గా చెక్ చేయడం. + +రెండు వేరువేరు keys కి ఒకే fingerprint వస్తే దాన్ని *collision* అంటారు. ఈ collisions ని +ఎలా handle చేస్తాం అనేది hashing వాడే చాలా applications లో చాలా ముఖ్యం. +ఫాస్ట్ గా పనిచేసే practical algorithms తయారుచేయడానికి hashing బాగా ఉపయోగపడుతుంది. + +## Rolling Hash + +**Rolling hash** (దీన్నే recursive hashing లేదా rolling checksum అని కూడా అంటారు) అనేది ఒక hash +function. ఇందులో input మీద ఒక window కదులుతూ ఉంటుంది, ఆ window లో ఉన్న దాన్ని hash చేస్తాం. + +కొన్ని hash functions లో rolling hash ని చాలా ఫాస్ట్ గా లెక్కపెట్టొచ్చు — కొత్త +hash value కోసం ఈ data ఉంటే చాలు: + +- పాత hash value, +- window నుంచి తీసేసిన పాత value, +- window లో కొత్తగా కలిపిన value. + +## Polynomial String Hashing + +Strings కి మంచి hash function అంటే, key లో ఏ symbols ఉన్నాయి (*multiset*) అనేదానిమీద, +ఇంకా ఆ symbols ఏ *order* లో ఉన్నాయి అనేదానిమీద — రెండిటిమీదా ఆధారపడాలి. ఇలాంటి hash functions లో +ఎక్కువగా వాడేది ఏంటంటే — string లో ఉన్న symbols ని ఒక integer variable `p` ఉన్న *polynomial* కి +coefficients లాగా చూసి, దాని value ని ఒక integer constant `M` modulo లో లెక్కపెట్టడం: + +*Rabin–Karp string search algorithm* ని మామూలుగా కేవలం గుణకారాలు, కూడికలు మాత్రమే వాడే +ఒక సింపుల్ rolling hash function తో explain చేస్తారు — అదే **polynomial rolling hash**: + +> H(s0, s1, ..., sk) = s0 * pk-1 + s1 * pk-2 + ... + sk * p0 + +ఇక్కడ `p` ఒక constant, *(s1, ... , sk)* అనేవి input +characters. + +ఉదాహరణకి, digit codes ని ఒక constant యొక్క powers తో గుణించి చిన్న strings ని key numbers గా +మార్చొచ్చు. `ace` అనే మూడు letters word ని ఇలా లెక్కపెట్టి ఒక నంబర్ గా మార్చొచ్చు: + +> key = 1 * 262 + 3 * 261 + 5 * 260 + +`H` values మరీ పెద్దవి కాకుండా ఉండటానికి, లెక్కలన్నీ modulo `M` లో చేస్తాం. + +> H(s0, s1, ..., sk) = (s0 * pk-1 + s1 * pk-2 + ... + sk * p0) mod M + +Hash function కి "మంచి" properties రావాలంటే, అంటే collisions తక్కువగా రావాలంటే, +`M`, `p` parameters ని జాగ్రత్తగా ఎంచుకోవాలి. + +ఈ పద్ధతిలో ఒక మంచి విషయం ఏంటంటే, input string లో ఉన్న అన్ని characters లెక్కలోకి వస్తాయి. +లెక్కపెట్టిన key value ని మామూలు పద్ధతిలోనే array index గా hash చేయొచ్చు: + +```javascript +function hash(key, arraySize) { + const base = 13; + + let hash = 0; + for (let charIndex = 0; charIndex < key.length; charIndex += 1) { + const charCode = key.charCodeAt(charIndex); + hash += charCode * (base ** (key.length - charIndex - 1)); + } + + return hash % arraySize; +} +``` + +ఈ `hash()` method ఉండాల్సినంత ఫాస్ట్ గా లేదు. Character ని మార్చడం కాకుండా, +loop లోపల రెండు గుణకారాలు, ఒక కూడిక ఉన్నాయి. **Horner's method** వాడితే +ఒక గుణకారం తగ్గించొచ్చు: + +> a4 * x4 + a3 * x3 + a2 * x2 + a1 * x1 + a0 = (((a4 * x + a3) * x + a2) * x + a1) * x + a0 + +ఇంకోలా చెప్పాలంటే: + +> Hi = (P * Hi-1 + Si) mod M + +పొడవైన strings వస్తే `hash()` పనిచేయదు, ఎందుకంటే hashVal అనేది int సైజ్ దాటిపోతుంది. +గమనించండి, చివరికి key ఎప్పుడూ array size కంటే తక్కువే ఉంటుంది. +Horner's method లో ప్రతి step లోనూ modulo (%) operator వాడొచ్చు. +చివర్లో ఒక్కసారి modulo వాడినా ఇదే result వస్తుంది, కానీ ఇలా చేస్తే overflow అవ్వదు. + +```javascript +function hash(key, arraySize) { + const base = 13; + + let hash = 0; + for (let charIndex = 0; charIndex < key.length; charIndex += 1) { + const charCode = key.charCodeAt(charIndex); + hash = (hash * base + charCode) % arraySize; + } + + return hash; +} +``` + +Polynomial hashing కి ఒక rolling property ఉంది: string చివర్లలో symbols కలిపినా, తీసేసినా +fingerprints ని ఫాస్ట్ గా update చేయొచ్చు (కావాల్సినంత పొడవు ఉన్న, p యొక్క powers modulo M ఉన్న ఒక +array ని store చేసి పెట్టుకుంటే చాలు). బాగా పాపులర్ అయిన Rabin–Karp pattern matching algorithm ఈ property మీదే బేస్ అయింది. + +## References + +- [Polynomial String Hashing ఎక్కడ వాడాలి](https://www.mii.lt/olympiads_in_informatics/pdf/INFOL119.pdf) +- [uTexas లో Hashing](https://www.cs.utexas.edu/~mitra/csSpring2017/cs313/lectures/hash.html) +- [Wikipedia లో Hash Function](https://en.wikipedia.org/wiki/Hash_function) +- [Wikipedia లో Rolling Hash](https://en.wikipedia.org/wiki/Rolling_hash) diff --git a/src/algorithms/cryptography/rail-fence-cipher/README.md b/src/algorithms/cryptography/rail-fence-cipher/README.md index d01395f554..f73aad0d1d 100644 --- a/src/algorithms/cryptography/rail-fence-cipher/README.md +++ b/src/algorithms/cryptography/rail-fence-cipher/README.md @@ -1,5 +1,8 @@ # Rail Fence Cipher +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + The **rail fence cipher** (also called a **zigzag cipher**) is a [transposition cipher](https://en.wikipedia.org/wiki/Transposition_cipher) in which the message is split across a set of rails on a fence for encoding. The fence is populated with the message's characters, starting at the top left and adding a character on each position, traversing them diagonally to the bottom. Upon reaching the last rail, the direction should then turn diagonal and upwards up to the very first rail in a zig-zag motion. Rinse and repeat until the message is fully disposed across the fence. The encoded message is the result of concatenating the text in each rail, from top to bottom. From [wikipedia](https://en.wikipedia.org/wiki/Rail_fence_cipher), this is what the message `WE ARE DISCOVERED. FLEE AT ONCE` looks like on a `3`-rail fence: diff --git a/src/algorithms/cryptography/rail-fence-cipher/README.tel-IN.md b/src/algorithms/cryptography/rail-fence-cipher/README.tel-IN.md new file mode 100644 index 0000000000..0e7477446d --- /dev/null +++ b/src/algorithms/cryptography/rail-fence-cipher/README.tel-IN.md @@ -0,0 +1,31 @@ +# Rail Fence Cipher + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +**Rail fence cipher** (దీన్నే **zigzag cipher** అని కూడా అంటారు) అనేది ఒక [transposition cipher](https://en.wikipedia.org/wiki/Transposition_cipher). ఇందులో encode చేయడానికి message ని ఒక fence (కంచె) మీద ఉన్న కొన్ని rails (వరుసలు) లోకి పంచుతాం. పైన ఎడమ వైపు నుంచి మొదలుపెట్టి, ప్రతి position లో ఒక character పెడుతూ, వాలుగా (diagonal గా) కిందకి వెళ్తాం. చివరి rail కి చేరగానే, మళ్ళీ వాలుగా పైకి, మొదటి rail వరకు zig-zag లాగా వెళ్తాం. Message మొత్తం fence మీద పరిచేదాకా ఇలాగే మళ్ళీ మళ్ళీ చేస్తాం. పై నుంచి కింద వరకు ప్రతి rail లో ఉన్న text ని కలిపితే వచ్చేదే encode అయిన message. + +[Wikipedia](https://en.wikipedia.org/wiki/Rail_fence_cipher) లో ఉన్నట్టు, `WE ARE DISCOVERED. FLEE AT ONCE` అనే message `3`-rail fence మీద ఇలా కనిపిస్తుంది: + +``` +W . . . E . . . C . . . R . . . L . . . T . . . E +. E . R . D . S . O . E . E . F . E . A . O . C . +. . A . . . I . . . V . . . D . . . E . . . N . . +------------------------------------------------- + WECRLTEERDSOEEFEAOCAIVDEN +``` + +Decode చేయడానికి, అదే zig-zag pattern తో encode అయిన fence ని మళ్ళీ తయారుచేస్తాం — కానీ ఒక్కోసారి ఒక్క rail లో మాత్రమే characters పెడతాం. ఇది అర్థమవ్వడానికి, ఇంకా నింపకూడని rails మీద ఒక dash (-) పెట్టొచ్చు. మొదటి rail నింపిన తర్వాత fence ఇలా కనిపిస్తుంది — dashes అంటే ఆ positions కి వెళ్ళాం కానీ ఇంకా నింపలేదు అని. + +``` +W . . . E . . . C . . . R . . . L . . . T . . . E +. - . - . - . - . - . - . - . - . - . - . - . - . +. . - . . . - . . . - . . . - . . . - . . . - . . +``` + +Fence లో visit చేసిన positions సంఖ్య, message లో ఉన్న characters సంఖ్యకి సమానం అవ్వగానే, తర్వాత rail నింపడం మొదలుపెట్టాలి. + +## References + +- [Wikipedia లో Rail Fence Cipher](https://en.wikipedia.org/wiki/Rail_fence_cipher) +- [Rail Fence Cipher Calculator](https://crypto.interactive-maths.com/rail-fence-cipher.html) diff --git a/src/algorithms/graph/articulation-points/README.md b/src/algorithms/graph/articulation-points/README.md index aa6bede7a4..daa49c94ae 100644 --- a/src/algorithms/graph/articulation-points/README.md +++ b/src/algorithms/graph/articulation-points/README.md @@ -1,5 +1,8 @@ # Articulation Points (or Cut Vertices) +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + A vertex in an undirected connected graph is an articulation point (or cut vertex) if removing it (and edges through it) disconnects the graph. Articulation points represent vulnerabilities in a diff --git a/src/algorithms/graph/articulation-points/README.tel-IN.md b/src/algorithms/graph/articulation-points/README.tel-IN.md new file mode 100644 index 0000000000..6a2996e2bb --- /dev/null +++ b/src/algorithms/graph/articulation-points/README.tel-IN.md @@ -0,0 +1,24 @@ +# Articulation Points (లేదా Cut Vertices) + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +ఒక undirected connected graph లో, ఒక vertex ని (దాని గుండా వెళ్ళే edges తో సహా) తీసేస్తే +graph ముక్కలైపోతే, ఆ vertex ని articulation point (లేదా cut vertex) అంటారు. +Connected network లో ఇవి బలహీనమైన పాయింట్లు — ఇలాంటి ఒక్క పాయింట్ fail అయినా +network 2 లేదా అంతకంటే ఎక్కువ విడివిడి ముక్కలుగా విడిపోతుంది. నమ్మకంగా పనిచేసే +networks డిజైన్ చేయడానికి ఇవి ఉపయోగపడతాయి. + +Disconnected undirected graph లో అయితే, ఏ vertex ని తీసేస్తే connected components సంఖ్య +పెరుగుతుందో, అదే articulation point. + +![Articulation Points](https://www.geeksforgeeks.org/wp-content/uploads/ArticulationPoints.png) + +![Articulation Points](https://www.geeksforgeeks.org/wp-content/uploads/ArticulationPoints1.png) + +![Articulation Points](https://www.geeksforgeeks.org/wp-content/uploads/ArticulationPoints21.png) + +## References + +- [GeeksForGeeks](https://www.geeksforgeeks.org/articulation-points-or-cut-vertices-in-a-graph/) +- [YouTube](https://www.youtube.com/watch?v=2kREIkF9UAs&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/graph/bellman-ford/README.md b/src/algorithms/graph/bellman-ford/README.md index 9c0922659e..b9db7128f7 100644 --- a/src/algorithms/graph/bellman-ford/README.md +++ b/src/algorithms/graph/bellman-ford/README.md @@ -1,5 +1,8 @@ # Bellman–Ford Algorithm +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + The Bellman–Ford algorithm is an algorithm that computes shortest paths from a single source vertex to all of the other vertices in a weighted digraph. It is slower than Dijkstra's algorithm diff --git a/src/algorithms/graph/bellman-ford/README.tel-IN.md b/src/algorithms/graph/bellman-ford/README.tel-IN.md new file mode 100644 index 0000000000..d23d4b4d59 --- /dev/null +++ b/src/algorithms/graph/bellman-ford/README.tel-IN.md @@ -0,0 +1,22 @@ +# Bellman–Ford Algorithm + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Bellman–Ford algorithm అనేది weighted digraph లో ఒక source vertex నుంచి మిగతా +అన్ని vertices కి shortest paths లెక్కపెట్టే algorithm. ఇదే problem కి +Dijkstra's algorithm కంటే ఇది slow గా ఉంటుంది, కానీ ఎక్కువ రకాల graphs కి పనిచేస్తుంది — +ఎందుకంటే కొన్ని edges కి weights negative numbers గా ఉన్నా ఇది handle చేయగలదు. + +![Bellman-Ford](https://upload.wikimedia.org/wikipedia/commons/2/2e/Shortest_path_Dijkstra_vs_BellmanFord.gif) + +## Complexity + +Worst-case performance `O(|V||E|)` +Best-case performance `O(|E|)` +Worst-case space complexity `O(|V|)` + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Bellman%E2%80%93Ford_algorithm) +- [YouTube లో Michael Sambol](https://www.youtube.com/watch?v=obWXjtg0L64&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/graph/breadth-first-search/README.md b/src/algorithms/graph/breadth-first-search/README.md index 06073abd8b..d7a19b37ae 100644 --- a/src/algorithms/graph/breadth-first-search/README.md +++ b/src/algorithms/graph/breadth-first-search/README.md @@ -1,5 +1,8 @@ # Breadth-First Search (BFS) +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + Breadth-first search (BFS) is an algorithm for traversing, searching tree, or graph data structures. It starts at the tree root (or some arbitrary node of a graph, sometimes diff --git a/src/algorithms/graph/breadth-first-search/README.tel-IN.md b/src/algorithms/graph/breadth-first-search/README.tel-IN.md new file mode 100644 index 0000000000..de5ef121df --- /dev/null +++ b/src/algorithms/graph/breadth-first-search/README.tel-IN.md @@ -0,0 +1,18 @@ +# Breadth-First Search (BFS) + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Breadth-first search (BFS) అనేది tree లేదా graph data structures ని traverse చేయడానికి, +search చేయడానికి వాడే algorithm. ఇది tree root నుంచి (graph అయితే ఏదో ఒక node నుంచి — +దాన్ని కొన్నిసార్లు 'search key' అంటారు) మొదలుపెట్టి, ముందు పక్కనే ఉన్న neighbor +nodes అన్నీ చూస్తుంది, ఆ తర్వాతే next level neighbors దగ్గరికి వెళ్తుంది. + +![Algorithm Visualization](https://upload.wikimedia.org/wikipedia/commons/5/5d/Breadth-First-Search-Algorithm.gif) + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Breadth-first_search) +- [Tree Traversals (Inorder, Preorder and Postorder)](https://www.geeksforgeeks.org/tree-traversals-inorder-preorder-and-postorder/) +- [BFS vs DFS](https://www.geeksforgeeks.org/bfs-vs-dfs-binary-tree/) +- [BFS Visualization](https://www.cs.usfca.edu/~galles/visualization/BFS.html) diff --git a/src/algorithms/graph/bridges/README.md b/src/algorithms/graph/bridges/README.md index 08d919ff96..5d668dd1d2 100644 --- a/src/algorithms/graph/bridges/README.md +++ b/src/algorithms/graph/bridges/README.md @@ -1,5 +1,8 @@ # Bridges in Graph +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + In graph theory, a **bridge**, **isthmus**, **cut-edge**, or **cut arc** is an edge of a graph whose deletion increases its number of connected components. Equivalently, an edge is a bridge if and only if it is not contained in any cycle. A graph is said diff --git a/src/algorithms/graph/bridges/README.tel-IN.md b/src/algorithms/graph/bridges/README.tel-IN.md new file mode 100644 index 0000000000..a71795212d --- /dev/null +++ b/src/algorithms/graph/bridges/README.tel-IN.md @@ -0,0 +1,29 @@ +# Graph లో Bridges + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Graph theory లో **bridge** (దీన్నే **isthmus**, **cut-edge**, లేదా **cut arc** అని కూడా అంటారు) అంటే +graph లో ఒక edge — దాన్ని తీసేస్తే connected components సంఖ్య పెరుగుతుంది. ఇంకోలా చెప్పాలంటే, +ఒక edge ఏ cycle లోనూ లేకపోతేనే అది bridge అవుతుంది. ఒక graph లో అసలు bridges ఏమీ లేకపోతే, +దాన్ని bridgeless లేదా isthmus-free graph అంటారు. + +![Bridges in graph](https://upload.wikimedia.org/wikipedia/commons/d/df/Graph_cut_edges.svg) + +16 vertices, 6 bridges (ఎరుపు రంగులో చూపించినవి) ఉన్న ఒక graph + +![Bridgeless](https://upload.wikimedia.org/wikipedia/commons/b/bf/Undirected.svg) + +ఒక్క cut edge కూడా లేని undirected connected graph + +![Bridges in graph](https://www.geeksforgeeks.org/wp-content/uploads/Bridge1.png) + +![Bridges in graph](https://www.geeksforgeeks.org/wp-content/uploads/Bridge2.png) + +![Bridges in graph](https://www.geeksforgeeks.org/wp-content/uploads/Bridge3.png) + +## References + +- [YouTube లో GeeksForGeeks](https://www.youtube.com/watch?v=thLQYBlz2DM&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) +- [Wikipedia](https://en.wikipedia.org/wiki/Bridge_%28graph_theory%29#Tarjan.27s_Bridge-finding_algorithm) +- [GeeksForGeeks](https://www.geeksforgeeks.org/bridge-in-a-graph/) diff --git a/src/algorithms/graph/depth-first-search/README.md b/src/algorithms/graph/depth-first-search/README.md index b22a8aa9c8..5550d77507 100644 --- a/src/algorithms/graph/depth-first-search/README.md +++ b/src/algorithms/graph/depth-first-search/README.md @@ -1,5 +1,8 @@ # Depth-First Search (DFS) +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. One starts at the root (selecting some arbitrary node as the root in diff --git a/src/algorithms/graph/depth-first-search/README.tel-IN.md b/src/algorithms/graph/depth-first-search/README.tel-IN.md new file mode 100644 index 0000000000..9aaf775b38 --- /dev/null +++ b/src/algorithms/graph/depth-first-search/README.tel-IN.md @@ -0,0 +1,18 @@ +# Depth-First Search (DFS) + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Depth-first search (DFS) అనేది tree లేదా graph data structures ని traverse చేయడానికి, +search చేయడానికి వాడే algorithm. Root నుంచి మొదలుపెడతాం (graph అయితే ఏదో ఒక node ని +root గా తీసుకుంటాం), ప్రతి branch లో వీలైనంత లోతుకి వెళ్ళి, ఇక ముందుకి దారి లేనప్పుడే +వెనక్కి (backtrack) వస్తాం. + +![Algorithm Visualization](https://upload.wikimedia.org/wikipedia/commons/7/7f/Depth-First-Search.gif) + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Depth-first_search) +- [Tree Traversals (Inorder, Preorder and Postorder)](https://www.geeksforgeeks.org/tree-traversals-inorder-preorder-and-postorder/) +- [BFS vs DFS](https://www.geeksforgeeks.org/bfs-vs-dfs-binary-tree/) +- [DFS Visualization](https://www.cs.usfca.edu/~galles/visualization/DFS.html) diff --git a/src/algorithms/graph/detect-cycle/README.md b/src/algorithms/graph/detect-cycle/README.md index 82641c78a2..f748bf8788 100644 --- a/src/algorithms/graph/detect-cycle/README.md +++ b/src/algorithms/graph/detect-cycle/README.md @@ -1,5 +1,8 @@ # Detect Cycle in Graphs +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + In graph theory, a **cycle** is a path of edges and vertices wherein a vertex is reachable from itself. There are several different types of cycles, principally a **closed walk** and diff --git a/src/algorithms/graph/detect-cycle/README.tel-IN.md b/src/algorithms/graph/detect-cycle/README.tel-IN.md new file mode 100644 index 0000000000..d4fa399945 --- /dev/null +++ b/src/algorithms/graph/detect-cycle/README.tel-IN.md @@ -0,0 +1,58 @@ +# Graphs లో Cycle కనుక్కోవడం + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Graph theory లో **cycle** అంటే edges, vertices తో ఏర్పడే ఒక path — అందులో ఒక vertex నుంచి +బయలుదేరి మళ్ళీ అదే vertex కి చేరుకోవచ్చు. Cycles లో చాలా రకాలు ఉన్నాయి, ముఖ్యమైనవి +**closed walk**, **simple cycle**. + +## Definitions + +**Closed walk** అంటే ఒకే vertex దగ్గర మొదలై అదే vertex దగ్గర ముగిసే vertices sequence. +ఆ sequence లో పక్కపక్కన ఉన్న ప్రతి రెండు vertices graph లో ఒకదానికొకటి adjacent గా ఉండాలి. +Directed graph లో అయితే, walk ప్రతి edge ని దాని direction లోనే దాటాలి: +అంటే edge అనేది sequence లో ముందు వచ్చే vertex నుంచి తర్వాత వచ్చే vertex వైపు ఉండాలి. +ఏ vertex నుంచి మొదలుపెడతాం అనేది ముఖ్యం కాదు: అదే cyclic edges sequence ని వేరువేరు +vertices నుంచి మొదలుపెట్టి దాటినా, అదే closed walk వస్తుంది. + +**Simple cycle** ని రెండు రకాలుగా చెప్పొచ్చు — మొదలు, చివర vertex తప్ప, vertices గానీ edges గానీ +రిపీట్ అవ్వని closed walk అని; లేదా అలాంటి walk లో ఉన్న edges సెట్ అని. Directed graphs లో ఈ రెండు +definitions ఒకటే — అక్కడ simple cycles ని directed cycles అని కూడా అంటారు: ఒక walk వాడే +edges సెట్ ని బట్టే దాని vertices, edges cyclic sequence పూర్తిగా తెలిసిపోతుంది. Undirected graphs లో +ఒక cycle edges సెట్ ని రెండు directions లో ఏ వైపు నుంచైనా దాటొచ్చు, కాబట్టి ప్రతి undirected cycle కి +రెండు directed cycles వస్తాయి. Circuit అంటే vertices రిపీట్ అవ్వొచ్చు కానీ edges రిపీట్ అవ్వని +closed walk కావొచ్చు; కానీ అది simple cycle కూడా కావొచ్చు, అందుకే ఈ పదం వాడినప్పుడు దాని అర్థం +క్లియర్ గా చెప్పడం మంచిది. + +## Example + +![Cycles](https://upload.wikimedia.org/wikipedia/commons/e/e7/Graph_cycle.gif) + +ఈ graph లో edges కి రంగులు వేసి చూపించారు: **path** `H-A-B` (ఆకుపచ్చ), closed path లేదా +**ఒక vertex రిపీట్ అయిన walk** `B-D-E-F-D-C-B` (నీలం), ఇంకా **ఏ edge గానీ vertex గానీ రిపీట్ అవ్వని cycle** +`H-D-G-H` (ఎరుపు) + +### Undirected graph లో Cycle + +![Undirected Cycle](https://www.geeksforgeeks.org/wp-content/uploads/cycleGraph.png) + +### Directed graph లో Cycle + +![Directed Cycle](https://cdncontribute.geeksforgeeks.org/wp-content/uploads/cycle.png) + +## References + +జనరల్ సమాచారం: + +- [Wikipedia](https://en.wikipedia.org/wiki/Cycle_(graph_theory)) + +Undirected graphs లో cycles: + +- [GeeksForGeeks లో Undirected Graph లో Cycle కనుక్కోవడం](https://www.geeksforgeeks.org/detect-cycle-undirected-graph/) +- [YouTube లో Undirected Graph లో Cycle కనుక్కునే Algorithm](https://www.youtube.com/watch?v=n_t0a_8H8VY&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) + +Directed graphs లో cycles: + +- [GeeksForGeeks లో Directed Graph లో Cycle కనుక్కోవడం](https://www.geeksforgeeks.org/detect-cycle-in-a-graph/) +- [YouTube లో Directed Graph లో Cycle కనుక్కునే Algorithm](https://www.youtube.com/watch?v=rKQaZuoUR4M&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/graph/dijkstra/README.de-DE.md b/src/algorithms/graph/dijkstra/README.de-DE.md index 59c80546e5..c1f76eb194 100644 --- a/src/algorithms/graph/dijkstra/README.de-DE.md +++ b/src/algorithms/graph/dijkstra/README.de-DE.md @@ -10,7 +10,8 @@ _Lies dies in anderen Sprachen:_ [_Español_](README.es-ES.md), [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) Der Dijkstra-Algorithmus ist ein Algorithmus zur Bestimmung der kürzesten Wege zwischen Knoten in einem Graphen, der beispielsweise Straßennetze darstellen kann. diff --git a/src/algorithms/graph/dijkstra/README.es-ES.md b/src/algorithms/graph/dijkstra/README.es-ES.md index 06261ca280..a53fc35a02 100644 --- a/src/algorithms/graph/dijkstra/README.es-ES.md +++ b/src/algorithms/graph/dijkstra/README.es-ES.md @@ -10,7 +10,8 @@ _Lee esto en otros idiomas:_ [_Español_](README.es-ES.md), [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) El algoritmo de Dijkstra es un algoritmo para encontrar los caminos más cortos entre nodos en un grafo, que puede representar, por ejemplo, redes de carreteras. diff --git a/src/algorithms/graph/dijkstra/README.fr-FR.md b/src/algorithms/graph/dijkstra/README.fr-FR.md index 45808e3afb..4c254e4ca0 100644 --- a/src/algorithms/graph/dijkstra/README.fr-FR.md +++ b/src/algorithms/graph/dijkstra/README.fr-FR.md @@ -10,7 +10,8 @@ _Lire ceci dans d’autres langues :_ [_Español_](README.es-ES.md), [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) L’algorithme de Dijkstra est un algorithme permettant de trouver les plus courts chemins entre des nœuds dans un graphe, pouvant représenter, par exemple, un réseau routier. diff --git a/src/algorithms/graph/dijkstra/README.he-IL.md b/src/algorithms/graph/dijkstra/README.he-IL.md index 0ff1942f98..734d6449a2 100644 --- a/src/algorithms/graph/dijkstra/README.he-IL.md +++ b/src/algorithms/graph/dijkstra/README.he-IL.md @@ -10,7 +10,8 @@ _קרא בשפות אחרות:_ [_Español_](README.es-ES.md), [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) אלגוריתם דייקסטרה הוא אלגוריתם למציאת המסלולים הקצרים ביותר בין צמתים בגרף, שיכול לייצג למשל רשת כבישים. diff --git a/src/algorithms/graph/dijkstra/README.ja-JP.md b/src/algorithms/graph/dijkstra/README.ja-JP.md index 648460c906..dc178bd2be 100644 --- a/src/algorithms/graph/dijkstra/README.ja-JP.md +++ b/src/algorithms/graph/dijkstra/README.ja-JP.md @@ -10,7 +10,8 @@ _他の言語で読む:_ [_Español_](README.es-ES.md), [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) ダイクストラ法は、グラフ内のノード間の最短経路を見つけるためのアルゴリズムです。 例えば道路網などを表すことができます。 diff --git a/src/algorithms/graph/dijkstra/README.ko-KR.md b/src/algorithms/graph/dijkstra/README.ko-KR.md index 1fca16981a..6b29f0a269 100644 --- a/src/algorithms/graph/dijkstra/README.ko-KR.md +++ b/src/algorithms/graph/dijkstra/README.ko-KR.md @@ -10,7 +10,8 @@ _다른 언어로 읽기:_ [_Español_](README.es-ES.md), [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) 다익스트라 알고리즘은 그래프의 노드 간 최단 경로를 찾는 알고리즘으로, 예를 들어 도로망을 표현할 수 있습니다. diff --git a/src/algorithms/graph/dijkstra/README.md b/src/algorithms/graph/dijkstra/README.md index c5dd44a46a..aa1feaad70 100644 --- a/src/algorithms/graph/dijkstra/README.md +++ b/src/algorithms/graph/dijkstra/README.md @@ -9,7 +9,8 @@ _Read this in other languages:_ [_Español_](README.es-ES.md), [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) Dijkstra's algorithm is an algorithm for finding the shortest paths between nodes in a graph, which may represent, for example, diff --git a/src/algorithms/graph/dijkstra/README.tel-IN.md b/src/algorithms/graph/dijkstra/README.tel-IN.md new file mode 100644 index 0000000000..a09514814a --- /dev/null +++ b/src/algorithms/graph/dijkstra/README.tel-IN.md @@ -0,0 +1,139 @@ +# Dijkstra's Algorithm + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_한국어_](README.ko-KR.md), +[_日本語_](README.ja-JP.md), +[_简体中文_](README.zh-CN.md), +[_繁體中文_](README.zh-TW.md), +[_Українська_](README.uk-UA.md), +[_Español_](README.es-ES.md), +[_Français_](README.fr-FR.md), +[_Deutsch_](README.de-DE.md), +[_עברית_](README.he-IL.md) + +Dijkstra's algorithm అనేది graph లో nodes మధ్య shortest paths కనుక్కునే algorithm. +ఆ graph ఉదాహరణకి ఒక road network కావొచ్చు. + +ఈ algorithm కి చాలా variants ఉన్నాయి. Dijkstra మొదట రాసిన variant రెండు nodes మధ్య +shortest path కనుక్కునేది. కానీ ఎక్కువగా వాడే variant ఏంటంటే — ఒక node ని "source" గా +fix చేసి, ఆ source నుంచి graph లో మిగతా అన్ని nodes కి shortest paths కనుక్కుంటుంది. +దాంతో ఒక shortest-path tree తయారవుతుంది. + +![Dijkstra](https://upload.wikimedia.org/wikipedia/commons/5/57/Dijkstra_Animation.gif) + +`a`, `b` మధ్య shortest path కనుక్కునే Dijkstra's algorithm. +ఇది ఇంకా visit చేయని vertices లో అతి తక్కువ distance ఉన్నదాన్ని తీసుకుని, +దాని గుండా ప్రతి unvisited neighbor కి distance లెక్కపెడుతుంది. ఆ distance ఇంకా తక్కువగా ఉంటే +neighbor distance ని update చేస్తుంది. Neighbors అన్నీ అయిపోయాక ఆ vertex ని visited +(ఎరుపు రంగు) గా mark చేస్తుంది. + +## Dijkstra's algorithm ని నిజ జీవితంలో ఎక్కడ వాడతారు + +- GPS / navigation systems +- Public transport, airline routes ని optimize చేయడం +- Internet routing (OSPF, IS-IS protocols) +- Network traffic, latency optimize చేయడం +- Games లో pathfinding (maps మీద shortest path) +- Logistics, delivery routes optimize చేయడం +- Supply chain, transportation network డిజైన్ + +## Dijkstra's algorithm step-by-step example + +మన దగ్గర ఒక weighted graph ఉంది అనుకుందాం, అందులో ప్రతి edge కి nodes మధ్య ఒక distance ఉంటుంది. ఉదాహరణకి node `A` నుంచి node `B` కి distance `7 meters` (షార్ట్ గా `7m`) అనుకుందాం, అలా మిగతావి కూడా. + +Origin node నుంచి అతి తక్కువ distance ఉన్న next unvisited vertex ని ఎప్పుడూ బయటికి తీయడానికి ఈ algorithm [Priority Queue](../../../data-structures/priority-queue/) వాడుతుంది. + +Start node కి తనకి తానే distance `0m` కదా. కాబట్టి దాంతోనే మొదలుపెడతాం — మొదట్లో priority queue లో ఉండేది అదొక్కటే. + +మిగతా nodes ని తర్వాత graph traverse చేసేటప్పుడు (neighbors ని visit చేసేటప్పుడు) priority queue లో కలుపుతాం. + +![Dijkstra step 1](./images/dijkstra-01.png) + +Queue నుంచి తీసిన node యొక్క ప్రతి neighbor దగ్గరికి వెళ్ళి, origin నుంచి దానికి distance లెక్కపెడతాం. ఉదాహరణకి `A` నుంచి `B` కి distance `0m + 7m = 7m`, అలా అన్నమాట. + +ఇంకా చూడని neighbor ని visit చేసిన ప్రతిసారి, దాన్ని priority queue లో కలుపుతాం. ఇక్కడ priority అంటే origin node నుంచి ఆ neighbor node కి ఉన్న distance. + +Node `B` ని తర్వాత traverse చేయడానికి min priority queue లో కలుపుతున్నాం. + +![Dijkstra step 2](./images/dijkstra-02.png) + +ఇప్పుడు node `A` యొక్క next neighbor `C` ని visit చేస్తున్నాం. Origin node `A` నుంచి `C` కి distance `0m + 9m = 9m`. + +Node `C` ని తర్వాత traverse చేయడానికి min priority queue లో కలుపుతున్నాం. + +![Dijkstra step 3](./images/dijkstra-03.png) + +Node `F` కి కూడా అంతే. Origin node `A` నుంచి `F` కి ఇప్పటి distance `0m + 14m = 14m`. + +Node `F` ని తర్వాత traverse చేయడానికి min priority queue లో కలుపుతున్నాం. + +![Dijkstra step 4](./images/dijkstra-04.png) + +ఇప్పటి node యొక్క neighbors అన్నీ చెక్ చేసేశాక, ఆ node ని `visited` set లో కలుపుతాం. తర్వాత traversals లో ఇలాంటి nodes ని మళ్ళీ visit చేయకూడదు. + +ఇప్పుడు priority queue నుంచి origin కి అతి దగ్గరగా ఉన్న (తక్కువ distance ఉన్న) next node ని బయటికి తీద్దాం. దాని neighbors ని కూడా visit చేయడం మొదలుపెడదాం. + +![Dijkstra step 5](./images/dijkstra-05.png) + +మనం visit చేస్తున్న node (ఇక్కడ node `C`) ఇప్పటికే queue లో ఉంటే, దానికి distance ఇంతకుముందే లెక్కపెట్టాం అని అర్థం — కానీ వేరే node/path (`A → C`) నుంచి. ఇప్పుడు (current neighbor node `A → B → C` నుంచి) వచ్చే distance ఇంతకుముందు లెక్కపెట్టినదానికంటే తక్కువ ఉంటే, (priority queue లో) distance ని తక్కువదానికి update చేస్తాం, ఎందుకంటే మనం shortest paths కోసమే వెతుకుతున్నాం. ఒకవేళ current neighbor నుంచి వచ్చే distance ఎక్కువగా ఉంటే, queue లో `C` node distance ని update చేయకుండా అలాగే వదిలేస్తాం. + +Node `C` ని `B` గుండా (path `A → B → C`) visit చేసేటప్పుడు, distance `7m + 10m = 17m` వస్తుంది. ఇది path `A → C` కి ఇప్పటికే రికార్డ్ చేసిన `9m` కంటే ఎక్కువ. ఇలాంటప్పుడు ఎక్కువ distance ని పట్టించుకోము, priority (ఆ టైమ్ కి origin node నుంచి దొరికిన minimum distance) ని update చేయము. + +![Dijkstra step 6](./images/dijkstra-06.png) + +ఇప్పుడు `B` యొక్క ఇంకో neighbor `D` ని visit చేస్తున్నాం. `D` కి distance `7m + 15m = 22m`. `D` ని ఇంకా visit చేయలేదు, అది min priority queue లో కూడా లేదు కాబట్టి, దాన్ని `22m` priority (distance) తో queue లో కలిపేద్దాం. + +![Dijkstra step 7](./images/dijkstra-07.png) + +ఇప్పటికి `B` యొక్క neighbors అందరినీ traverse చేసేశాం, కాబట్టి `B` ని `visited` set లో కలుపుతాం. తర్వాత, priority queue నుంచి origin node కి అతి దగ్గరగా ఉన్న node ని తీస్తాం. + +![Dijkstra step 8](./images/dijkstra-08.png) + +Node `C` యొక్క unvisited neighbors ని traverse చేస్తున్నాం. `C` గుండా (path `A → C → F`) node `F` కి distance `9m + 2m = 11m`. ఇది ఇంతకుముందు రికార్డ్ చేసిన `A → F` path యొక్క `14m` కంటే తక్కువ. ఇలాంటప్పుడు `F` కి distance ని `11m` గా update చేసి, queue లో దాని priority ని `14m` నుంచి `11m` కి మారుస్తాం. `F` కి ఇంకా చిన్న path దొరికింది. + +![Dijkstra step 9](./images/dijkstra-09.png) + +`D` కి కూడా అంతే. `D` కి ఇంకా చిన్న path దొరికింది — `A → C → D` అనేది `A → B → D` కంటే చిన్నది. Distance ని `22m` నుంచి `20m` కి update చేస్తున్నాం. + +![Dijkstra step 10](./images/dijkstra-10.png) + +`C` యొక్క neighbors అందరినీ traverse చేసేశాం, కాబట్టి `C` ని `visited` set లో కలపొచ్చు. Queue నుంచి next దగ్గరి node ని తీస్తున్నాం, అది `F`. + +![Dijkstra step 11](./images/dijkstra-11.png) + +`E` కి distance ని `11m + 9m = 20m` గా రికార్డ్ చేస్తున్నాం. + +![Dijkstra step 12](./images/dijkstra-12.png) + +Node `F` ని `visited` set లో కలిపి, queue నుంచి next దగ్గరి node `D` ని తీస్తున్నాం. + +![Dijkstra step 13](./images/dijkstra-13.png) + +`D` గుండా `E` కి distance `20m + 6m = 26m`. ఇది `F` నుంచి `E` కి ఇప్పటికే లెక్కపెట్టిన `20m` కంటే ఎక్కువ. ఎక్కువ distance ని వదిలేయొచ్చు. + +![Dijkstra step 14](./images/dijkstra-14.png) + +ఇప్పుడు node `D` visit అయిపోయింది. + +![Dijkstra step 15](./images/dijkstra-15.png) + +Node `E` కూడా visit అయిపోయింది. Graph traversal అయిపోయింది. + +![Dijkstra step 16](./images/dijkstra-16.png) + +ఇప్పుడు start node `A` నుంచి ప్రతి node కి shortest distances మనకి తెలుసు. + +నిజంగా implement చేసేటప్పుడు, distances లెక్కపెడుతూనే ప్రతి node కి `previousVertices` ని కూడా రికార్డ్ చేస్తాం — దాంతో shortest path ఏ nodes వరుసలో వెళ్తుందో exact గా చూపించొచ్చు. + +ఉదాహరణకి, `A` నుంచి `E` కి shortest path `A → C → F → E`. + +## Implementation example + +- [dijkstra.js](./dijkstra.js) + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm) +- [YouTube లో Nathaniel Fan](https://www.youtube.com/watch?v=gdmfOwyQlcI&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) +- [YouTube లో Tushar Roy](https://www.youtube.com/watch?v=lAXZGERcDf4&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/graph/dijkstra/README.uk-UA.md b/src/algorithms/graph/dijkstra/README.uk-UA.md index fc2436db08..021e8ecf27 100644 --- a/src/algorithms/graph/dijkstra/README.uk-UA.md +++ b/src/algorithms/graph/dijkstra/README.uk-UA.md @@ -10,7 +10,8 @@ _Читайте іншими мовами:_ [_Español_](README.es-ES.md), [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) Алгоритм Дейкстри — це алгоритм пошуку найкоротших шляхів між вершинами графа, який може представляти, наприклад, дорожню мережу. diff --git a/src/algorithms/graph/dijkstra/README.zh-CN.md b/src/algorithms/graph/dijkstra/README.zh-CN.md index 382a9dee05..d3be06c91e 100644 --- a/src/algorithms/graph/dijkstra/README.zh-CN.md +++ b/src/algorithms/graph/dijkstra/README.zh-CN.md @@ -10,7 +10,8 @@ _阅读其他语言版本:_ [_Español_](README.es-ES.md), [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) Dijkstra 算法是一种用于在图中查找节点之间最短路径的算法,例如,它可以用于表示道路网络。 diff --git a/src/algorithms/graph/dijkstra/README.zh-TW.md b/src/algorithms/graph/dijkstra/README.zh-TW.md index e960b41797..d3ef78aa0a 100644 --- a/src/algorithms/graph/dijkstra/README.zh-TW.md +++ b/src/algorithms/graph/dijkstra/README.zh-TW.md @@ -10,7 +10,8 @@ _以其他語言閱讀:_ [_Español_](README.es-ES.md), [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), -[_עברית_](README.he-IL.md) +[_עברית_](README.he-IL.md), +[_తెలుగు_](README.tel-IN.md) Dijkstra 演算法是一種用於在圖中尋找節點之間最短路徑的演算法,例如,它可用於表示道路網絡。 diff --git a/src/algorithms/graph/eulerian-path/README.md b/src/algorithms/graph/eulerian-path/README.md index 597a9ef32e..a8afa25707 100644 --- a/src/algorithms/graph/eulerian-path/README.md +++ b/src/algorithms/graph/eulerian-path/README.md @@ -1,5 +1,8 @@ # Eulerian Path +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + In graph theory, an **Eulerian trail** (or **Eulerian path**) is a trail in a finite graph which visits every edge exactly once. Similarly, an **Eulerian circuit** or **Eulerian cycle** is an diff --git a/src/algorithms/graph/eulerian-path/README.tel-IN.md b/src/algorithms/graph/eulerian-path/README.tel-IN.md new file mode 100644 index 0000000000..b901f1a70a --- /dev/null +++ b/src/algorithms/graph/eulerian-path/README.tel-IN.md @@ -0,0 +1,32 @@ +# Eulerian Path + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Graph theory లో **Eulerian trail** (లేదా **Eulerian path**) అంటే finite graph లో ప్రతి edge ని +సరిగ్గా ఒక్కసారి మాత్రమే visit చేసే trail. అలాగే **Eulerian circuit** లేదా **Eulerian cycle** +అంటే ఒకే vertex దగ్గర మొదలై అదే vertex దగ్గర ముగిసే Eulerian trail. + +Eulerian circuit ఉండాలంటే graph లో ఉన్న అన్ని vertices కి even degree ఉండాలి అని Euler +prove చేశాడు. ఇంకా, అన్ని vertices కి even degree ఉన్న connected graphs లో Eulerian circuit +ఉంటుంది అని కూడా చెప్పాడు. + +![Eulerian Circuit](https://upload.wikimedia.org/wikipedia/commons/7/72/Labelled_Eulergraph.svg) + +ఈ graph లో ప్రతి vertex కి even degree ఉంది. కాబట్టి ఇది ఒక Eulerian graph. +Edges ని alphabetical order లో ఫాలో అయితే ఒక Eulerian circuit/cycle వస్తుంది. + +Eulerian trail ఉండాలంటే, odd degree ఉన్న vertices zero గానీ రెండు గానీ ఉండాలి; అందుకే +Königsberg graph Eulerian కాదు. Odd degree ఉన్న vertices అసలు లేకపోతే, అన్ని Eulerian trails +circuits అవుతాయి. సరిగ్గా రెండు vertices కి odd degree ఉంటే, అన్ని Eulerian trails వాటిలో +ఒక దాని దగ్గర మొదలై ఇంకో దాని దగ్గర ముగుస్తాయి. Eulerian trail ఉండి Eulerian circuit +లేని graph ని semi-Eulerian అంటారు. + +![Königsberg graph](https://upload.wikimedia.org/wikipedia/commons/9/96/K%C3%B6nigsberg_graph.svg) + +Königsberg Bridges multigraph. ఈ multigraph Eulerian కాదు, కాబట్టి దీనికి solution లేదు. + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Eulerian_path) +- [YouTube](https://www.youtube.com/watch?v=vvP4Fg4r-Ns&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/graph/floyd-warshall/README.md b/src/algorithms/graph/floyd-warshall/README.md index f662861305..feef9cd85a 100644 --- a/src/algorithms/graph/floyd-warshall/README.md +++ b/src/algorithms/graph/floyd-warshall/README.md @@ -1,5 +1,8 @@ # Floyd–Warshall Algorithm +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + In computer science, the **Floyd–Warshall algorithm** is an algorithm for finding shortest paths in a weighted graph with positive or negative edge weights (but with no negative cycles). A single execution of the algorithm will find the diff --git a/src/algorithms/graph/floyd-warshall/README.tel-IN.md b/src/algorithms/graph/floyd-warshall/README.tel-IN.md new file mode 100644 index 0000000000..c49d3ed00f --- /dev/null +++ b/src/algorithms/graph/floyd-warshall/README.tel-IN.md @@ -0,0 +1,95 @@ +# Floyd–Warshall Algorithm + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Computer science లో **Floyd–Warshall algorithm** అనేది weighted graph లో shortest paths +కనుక్కునే algorithm. Edge weights positive అయినా negative అయినా పర్లేదు (కానీ +negative cycles ఉండకూడదు). ఈ algorithm ని ఒక్కసారి రన్ చేస్తే, ప్రతి జత vertices మధ్య +shortest paths యొక్క lengths (weights మొత్తం) వచ్చేస్తాయి. Paths ఏంటో details ఇవ్వదు కానీ, +algorithm లో చిన్న మార్పులు చేస్తే ఆ paths ని కూడా మళ్ళీ కట్టొచ్చు. + +## Algorithm + +Floyd–Warshall algorithm ప్రతి జత vertices మధ్య graph గుండా వెళ్ళే అన్ని possible paths ని +compare చేస్తుంది. ఇది graph లో `O(|V|^3)` comparisons తో ఈ పని చేయగలదు. +Graph లో `|V|^2` వరకు edges ఉండొచ్చు, ప్రతి edges combination ని test చేస్తుంది అని +ఆలోచిస్తే — ఇది నిజంగా గొప్ప విషయం. రెండు vertices మధ్య shortest path కి ఒక అంచనా +పెట్టుకుని, అది బెస్ట్ అయ్యేదాకా కొద్దికొద్దిగా ఆ అంచనాని మెరుగుపరుస్తూ వెళ్తుంది. + +`1` నుంచి `N` వరకు నంబర్లు ఉన్న vertices `V` తో ఒక graph `G` అనుకుందాం. ఇంకా +`shortestPath(i, j, k)` అనే ఒక function అనుకుందాం — ఇది దారిలో మధ్యలో `{1, 2, ..., k}` set లో +ఉన్న vertices ని మాత్రమే వాడుకుంటూ `i` నుంచి `j` కి వీలైనంత చిన్న path ఇస్తుంది. ఈ function +ఉంటే, మన goal ఏంటంటే — `{1, 2, ..., N}` లో ఉన్న vertices ని మాత్రమే వాడుకుంటూ ప్రతి `i` నుంచి +ప్రతి `j` కి shortest path కనుక్కోవడం. + +![Recursive Formula](https://wikimedia.org/api/rest_v1/media/math/render/svg/f9b75e25063384ccca499c56f9a279abf661ad3b) + +![Recursive Formula](https://wikimedia.org/api/rest_v1/media/math/render/svg/34ac7c89bbb18df3fd660225fd38997079e5e513) +![Recursive Formula](https://wikimedia.org/api/rest_v1/media/math/render/svg/0326d6c14def89269c029da59eba012d0f2edc9d) + +ఈ formula నే Floyd–Warshall algorithm కి గుండెకాయ. + +## Example + +పైన చెప్పిన algorithm ని కింద ఎడమ వైపు ఉన్న graph మీద రన్ చేశారు: + +![Example](https://upload.wikimedia.org/wikipedia/commons/2/2e/Floyd-Warshall_example.svg) + +కింద tables లో `i` అంటే row నంబర్లు, `j` అంటే column నంబర్లు. + + +**k = 0** + +| | 1 | 2 | 3 | 4 | +|:-----:|:---:|:---:|:---:|:---:| +| **1** | 0 | ∞ | −2 | ∞ | +| **2** | 4 | 0 | 3 | ∞ | +| **3** | ∞ | ∞ | 0 | 2 | +| **4** | ∞ | −1 | ∞ | 0 | + + +**k = 1** + +| | 1 | 2 | 3 | 4 | +|:-----:|:---:|:---:|:---:|:---:| +| **1** | 0 | ∞ | −2 | ∞ | +| **2** | 4 | 0 | 2 | ∞ | +| **3** | ∞ | ∞ | 0 | 2 | +| **4** | ∞ | − | ∞ | 0 | + + +**k = 2** + +| | 1 | 2 | 3 | 4 | +|:-----:|:---:|:---:|:---:|:---:| +| **1** | 0 | ∞ | −2 | ∞ | +| **2** | 4 | 0 | 2 | ∞ | +| **3** | ∞ | ∞ | 0 | 2 | +| **4** | 3 | −1 | 1 | 0 | + + +**k = 3** + +| | 1 | 2 | 3 | 4 | +|:-----:|:---:|:---:|:---:|:---:| +| **1** | 0 | ∞ | −2 | 0 | +| **2** | 4 | 0 | 2 | 4 | +| **3** | ∞ | ∞ | 0 | 2 | +| **4** | 3 | −1 | 1 | 0 | + + +**k = 4** + +| | 1 | 2 | 3 | 4 | +|:-----:|:---:|:---:|:---:|:---:| +| **1** | 0 | −1 | −2 | 0 | +| **2** | 4 | 0 | 2 | 4 | +| **3** | 5 | 1 | 0 | 2 | +| **4** | 3 | −1 | 1 | 0 | + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm) +- [YouTube (Abdul Bari)](https://www.youtube.com/watch?v=oNI0rf2P9gE&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&index=74) +- [YouTube (Tushar Roy)](https://www.youtube.com/watch?v=LwJdNfdLF9s&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&index=75) diff --git a/src/algorithms/graph/hamiltonian-cycle/README.md b/src/algorithms/graph/hamiltonian-cycle/README.md index ccd15481ba..7d0ebaf1bc 100644 --- a/src/algorithms/graph/hamiltonian-cycle/README.md +++ b/src/algorithms/graph/hamiltonian-cycle/README.md @@ -1,5 +1,8 @@ # Hamiltonian Path +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + **Hamiltonian path** (or **traceable path**) is a path in an undirected or directed graph that visits each vertex exactly once. A **Hamiltonian cycle** (or **Hamiltonian circuit**) is a diff --git a/src/algorithms/graph/hamiltonian-cycle/README.tel-IN.md b/src/algorithms/graph/hamiltonian-cycle/README.tel-IN.md new file mode 100644 index 0000000000..f0558e09d9 --- /dev/null +++ b/src/algorithms/graph/hamiltonian-cycle/README.tel-IN.md @@ -0,0 +1,46 @@ +# Hamiltonian Path + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +**Hamiltonian path** (లేదా **traceable path**) అంటే undirected లేదా directed graph లో +ప్రతి vertex ని సరిగ్గా ఒక్కసారి మాత్రమే visit చేసే path. **Hamiltonian cycle** (లేదా +**Hamiltonian circuit**) అంటే cycle గా ఉండే Hamiltonian path. Graph లో ఇలాంటి paths, +cycles ఉన్నాయా లేదా అని కనుక్కోవడమే **Hamiltonian path problem**. + +![Hamiltonian cycle](https://upload.wikimedia.org/wikipedia/commons/6/6c/Hamiltonian_path_3d.svg) + +Dodecahedron లో ప్రతి vertex గుండా వెళ్ళే ఒక Hamiltonian cycle ఎరుపు రంగులో చూపించారు — +అన్ని platonic solids లాగానే, dodecahedron కూడా Hamiltonian. + +## Naive Algorithm + +Vertices తో వచ్చే అన్ని configurations తయారుచేసి, ఇచ్చిన conditions కి సరిపోయే +configuration ని print చేయాలి. మొత్తం `n!` (n factorial) configurations వస్తాయి. + +``` +while there are untried configurations +{ + generate the next configuration + if ( there are edges between two consecutive vertices of this + configuration and there is an edge from the last vertex to + the first ). + { + print this configuration; + break; + } +} +``` + +## Backtracking Algorithm + +ఒక ఖాళీ path array తీసుకుని దాంట్లో vertex `0` పెట్టండి. తర్వాత vertex `1` నుంచి +మొదలుపెట్టి మిగతా vertices కలపండి. ఒక vertex కలిపే ముందు, అది ఇంతకుముందు కలిపిన vertex కి +adjacent గా ఉందా, ఇంకా ఇప్పటికే కలపలేదా అని చెక్ చేయండి. అలాంటి vertex దొరికితే, దాన్ని +solution లో భాగంగా కలుపుతాం. దొరకకపోతే false return చేస్తాం. + +## References + +- [Wikipedia లో Hamiltonian path](https://en.wikipedia.org/wiki/Hamiltonian_path) +- [YouTube లో Hamiltonian path](https://www.youtube.com/watch?v=dQr4wZCiJJ4&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) +- [GeeksForGeeks లో Hamiltonian cycle](https://www.geeksforgeeks.org/backtracking-set-7-hamiltonian-cycle/) diff --git a/src/algorithms/graph/kruskal/README.md b/src/algorithms/graph/kruskal/README.md index 1a71390e2f..dca131b1a4 100644 --- a/src/algorithms/graph/kruskal/README.md +++ b/src/algorithms/graph/kruskal/README.md @@ -1,7 +1,8 @@ # Kruskal's Algorithm _Read this in other languages:_ -[_한국어_](README.ko-KR.md) +[_한국어_](README.ko-KR.md), +[_తెలుగు_](README.tel-IN.md) Kruskal's algorithm is a minimum-spanning-tree algorithm which finds an edge of the least possible weight that connects any two diff --git a/src/algorithms/graph/kruskal/README.tel-IN.md b/src/algorithms/graph/kruskal/README.tel-IN.md new file mode 100644 index 0000000000..13a9dac63f --- /dev/null +++ b/src/algorithms/graph/kruskal/README.tel-IN.md @@ -0,0 +1,45 @@ +# Kruskal's Algorithm + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_한국어_](README.ko-KR.md) + +Kruskal's algorithm అనేది ఒక minimum-spanning-tree algorithm. ఇది forest లో ఏవైనా రెండు +trees ని కలిపే, అతి తక్కువ weight ఉన్న edge ని కనుక్కుంటుంది. Graph theory లో ఇది ఒక greedy +algorithm — ఎందుకంటే connected weighted graph కి minimum spanning tree కనుక్కోడానికి, +ప్రతి step లో cost పెరిగే వరుసలో edges (arcs) కలుపుతూ వెళ్తుంది. అంటే, ప్రతి vertex ని +కలిపే ఒక tree ని తయారుచేసే edges subset ని కనుక్కుంటుంది — ఆ tree లో ఉన్న అన్ని edges +weight మొత్తం వీలైనంత తక్కువగా ఉంటుంది. Graph connected కాకపోతే, ఇది ఒక minimum spanning +forest కనుక్కుంటుంది (ప్రతి connected component కి ఒక minimum spanning tree). + +![Kruskal Algorithm](https://upload.wikimedia.org/wikipedia/commons/5/5c/MST_kruskal_en.gif) + +![Kruskal Demo](https://upload.wikimedia.org/wikipedia/commons/b/bb/KruskalDemo.gif) + +Euclidean distance మీద బేస్ అయిన Kruskal's algorithm demo. + +## Minimum Spanning Tree + +**Minimum spanning tree** (MST) లేదా minimum weight spanning tree అంటే — connected, +edge-weighted (un)directed graph లో అన్ని vertices ని కలిపే edges subset. అందులో ఒక్క cycle +కూడా ఉండదు, ఇంకా edges weight మొత్తం వీలైనంత తక్కువగా ఉంటుంది. అంటే, edge weights మొత్తం +అతి చిన్నగా ఉండే spanning tree. ఇంకా జనరల్ గా చెప్పాలంటే, ఏ edge-weighted undirected graph కైనా +(connected కాకపోయినా) ఒక minimum spanning forest ఉంటుంది — అది దాని connected components +యొక్క minimum spanning trees అన్నీ కలిపితే వచ్చేది. + +![Minimum Spanning Tree](https://upload.wikimedia.org/wikipedia/commons/d/d2/Minimum_spanning_tree.svg) + +ఒక planar graph, దాని minimum spanning tree. ప్రతి edge మీద దాని weight రాసి ఉంది — +ఇక్కడ అది దాదాపు ఆ edge పొడవుకి proportional గా ఉంది. + +![Minimum Spanning Tree](https://upload.wikimedia.org/wikipedia/commons/c/c9/Multiple_minimum_spanning_trees.svg) + +ఒక graph కి ఒకటి కంటే ఎక్కువ minimum spanning trees ఉండొచ్చు అని ఈ బొమ్మ చూపిస్తుంది. +బొమ్మలో graph కింద ఉన్న రెండు trees, ఆ graph కి వచ్చే రెండు possible minimum spanning trees. + +## References + +- [Wikipedia లో Minimum Spanning Tree](https://en.wikipedia.org/wiki/Minimum_spanning_tree) +- [Wikipedia లో Kruskal's Algorithm](https://en.wikipedia.org/wiki/Kruskal%27s_algorithm) +- [YouTube లో Tushar Roy - Kruskal's Algorithm](https://www.youtube.com/watch?v=fAuF0EuZVCk&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) +- [YouTube లో Michael Sambol - Kruskal's Algorithm](https://www.youtube.com/watch?v=71UQH7Pr9kU&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/graph/prim/README.md b/src/algorithms/graph/prim/README.md index 49061a278e..6f616aaa78 100644 --- a/src/algorithms/graph/prim/README.md +++ b/src/algorithms/graph/prim/README.md @@ -1,5 +1,8 @@ # Prim's Algorithm +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + In computer science, **Prim's algorithm** is a greedy algorithm that finds a minimum spanning tree for a weighted undirected graph. diff --git a/src/algorithms/graph/prim/README.tel-IN.md b/src/algorithms/graph/prim/README.tel-IN.md new file mode 100644 index 0000000000..2962d91702 --- /dev/null +++ b/src/algorithms/graph/prim/README.tel-IN.md @@ -0,0 +1,43 @@ +# Prim's Algorithm + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Computer science లో **Prim's algorithm** అనేది weighted undirected graph కి minimum +spanning tree కనుక్కునే ఒక greedy algorithm. + +ఈ algorithm ఏదో ఒక starting vertex నుంచి మొదలుపెట్టి, ఒక్కో vertex కలుపుతూ ఈ tree ని +కడుతుంది. ప్రతి step లో, tree నుంచి ఇంకో vertex కి ఉన్న connections లో అతి చీప్ (తక్కువ weight) +connection ని కలుపుతుంది. + +![Prim's Algorithm](https://upload.wikimedia.org/wikipedia/commons/f/f7/Prim%27s_algorithm.svg) + +Vertex `A` నుంచి మొదలయ్యే Prim's algorithm. మూడో step లో, edges `BD`, `AB` రెండిటికీ +weight `2` ఉంది, కాబట్టి `BD` ని ఊరికే ఎంచుకున్నాం. ఆ step తర్వాత, `AB` ని ఇక tree లో +కలపలేం — ఎందుకంటే అది ఇప్పటికే tree లో ఉన్న రెండు nodes ని కలుపుతుంది. + +## Minimum Spanning Tree + +**Minimum spanning tree** (MST) లేదా minimum weight spanning tree అంటే — connected, +edge-weighted (un)directed graph లో అన్ని vertices ని కలిపే edges subset. అందులో ఒక్క cycle +కూడా ఉండదు, ఇంకా edges weight మొత్తం వీలైనంత తక్కువగా ఉంటుంది. అంటే, edge weights మొత్తం +అతి చిన్నగా ఉండే spanning tree. ఇంకా జనరల్ గా చెప్పాలంటే, ఏ edge-weighted undirected graph కైనా +(connected కాకపోయినా) ఒక minimum spanning forest ఉంటుంది — అది దాని connected components +యొక్క minimum spanning trees అన్నీ కలిపితే వచ్చేది. + +![Minimum Spanning Tree](https://upload.wikimedia.org/wikipedia/commons/d/d2/Minimum_spanning_tree.svg) + +ఒక planar graph, దాని minimum spanning tree. ప్రతి edge మీద దాని weight రాసి ఉంది — +ఇక్కడ అది దాదాపు ఆ edge పొడవుకి proportional గా ఉంది. + +![Minimum Spanning Tree](https://upload.wikimedia.org/wikipedia/commons/c/c9/Multiple_minimum_spanning_trees.svg) + +ఒక graph కి ఒకటి కంటే ఎక్కువ minimum spanning trees ఉండొచ్చు అని ఈ బొమ్మ చూపిస్తుంది. +బొమ్మలో graph కింద ఉన్న రెండు trees, ఆ graph కి వచ్చే రెండు possible minimum spanning trees. + +## References + +- [Wikipedia లో Minimum Spanning Tree](https://en.wikipedia.org/wiki/Minimum_spanning_tree) +- [Wikipedia లో Prim's Algorithm](https://en.wikipedia.org/wiki/Prim%27s_algorithm) +- [YouTube లో Tushar Roy - Prim's Algorithm](https://www.youtube.com/watch?v=oP2-8ysT3QQ&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) +- [YouTube లో Michael Sambol - Prim's Algorithm](https://www.youtube.com/watch?v=cplfcGZmX7I&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/graph/strongly-connected-components/README.md b/src/algorithms/graph/strongly-connected-components/README.md index 74f23ce051..a11b281319 100644 --- a/src/algorithms/graph/strongly-connected-components/README.md +++ b/src/algorithms/graph/strongly-connected-components/README.md @@ -1,5 +1,8 @@ # Strongly Connected Component +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + A directed graph is called **strongly connected** if there is a path in each direction between each pair of vertices of the graph. In a directed graph G that may not itself be strongly connected, diff --git a/src/algorithms/graph/strongly-connected-components/README.tel-IN.md b/src/algorithms/graph/strongly-connected-components/README.tel-IN.md new file mode 100644 index 0000000000..0cd973a596 --- /dev/null +++ b/src/algorithms/graph/strongly-connected-components/README.tel-IN.md @@ -0,0 +1,18 @@ +# Strongly Connected Component + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +ఒక directed graph లో ప్రతి జత vertices మధ్య రెండు directions లోనూ path ఉంటే, ఆ graph ని +**strongly connected** అంటారు. Graph G మొత్తం strongly connected కాకపోయినా, అందులో +`u`, `v` అనే రెండు vertices మధ్య రెండు directions లోనూ path ఉంటే, ఆ రెండు ఒకదానికొకటి +strongly connected అంటారు. + +![Strongly Connected](https://upload.wikimedia.org/wikipedia/commons/5/5c/Scc.png) + +Strongly connected components ని mark చేసిన graph + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Strongly_connected_component) +- [YouTube](https://www.youtube.com/watch?v=RpgcYiky7uw&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/graph/topological-sorting/README.md b/src/algorithms/graph/topological-sorting/README.md index f4653a8b1e..1bc4c364f4 100644 --- a/src/algorithms/graph/topological-sorting/README.md +++ b/src/algorithms/graph/topological-sorting/README.md @@ -1,5 +1,8 @@ # Topological Sorting +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + In the field of computer science, a topological sort or topological ordering of a directed graph is a linear ordering of its vertices such that for every directed edge `uv` from diff --git a/src/algorithms/graph/topological-sorting/README.tel-IN.md b/src/algorithms/graph/topological-sorting/README.tel-IN.md new file mode 100644 index 0000000000..b7a1dad18a --- /dev/null +++ b/src/algorithms/graph/topological-sorting/README.tel-IN.md @@ -0,0 +1,54 @@ +# Topological Sorting + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Computer science లో, directed graph యొక్క topological sort (లేదా topological ordering) +అంటే దాని vertices ని ఒక వరుసలో పెట్టడం — ఎలాగంటే, vertex `u` నుంచి vertex `v` కి ఉన్న +ప్రతి directed edge `uv` కి, ఆ వరుసలో `u` ఎప్పుడూ `v` కంటే ముందు రావాలి. + +ఉదాహరణకి, graph లో vertices అంటే చేయాల్సిన పనులు (tasks) అనుకోండి, edges అంటే "ఈ పని +అయ్యాకే ఆ పని చేయాలి" అనే conditions అనుకోండి; ఇక్కడ topological ordering అంటే ఆ పనులు +చేయడానికి ఒక కరెక్ట్ వరుస అన్నమాట. + +Graph లో directed cycles లేకపోతేనే topological ordering కుదురుతుంది, అంటే అది ఒక +[directed acyclic graph](https://en.wikipedia.org/wiki/Directed_acyclic_graph) (DAG) అయి ఉండాలి. +ప్రతి DAG కి కనీసం ఒక topological ordering ఉంటుంది. ఏ DAG కైనా linear time లో topological +ordering తయారుచేసే algorithms ఉన్నాయి. + +![Directed Acyclic Graph](https://upload.wikimedia.org/wikipedia/commons/c/c6/Topological_Ordering.svg) + +ఒక directed acyclic graph యొక్క topological ordering: ప్రతి edge వరుసలో ముందు ఉన్నదాని (పైన ఎడమ) +నుంచి వరుసలో తర్వాత ఉన్నదాని (కింద కుడి) వైపు వెళ్తుంది. ఒక directed graph కి topological ordering +ఉంటేనే అది acyclic. + +## Example + +![Topologic Sorting](https://upload.wikimedia.org/wikipedia/commons/0/03/Directed_acyclic_graph_2.svg) + +పైన చూపించిన graph కి చాలా కరెక్ట్ topological sorts ఉన్నాయి, అందులో కొన్ని: + +- `5, 7, 3, 11, 8, 2, 9, 10` (చూడటానికి ఎడమ నుంచి కుడికి, పై నుంచి కిందకి) +- `3, 5, 7, 8, 11, 2, 9, 10` (అందుబాటులో ఉన్న వాటిలో చిన్న నంబర్ vertex ముందు) +- `5, 7, 3, 8, 11, 10, 9, 2` (తక్కువ edges ఉన్నవి ముందు) +- `7, 5, 11, 3, 10, 8, 9, 2` (అందుబాటులో ఉన్న వాటిలో పెద్ద నంబర్ vertex ముందు) +- `5, 7, 11, 2, 3, 8, 9, 10` (పై నుంచి కిందకి, ఎడమ నుంచి కుడికి ట్రై చేస్తూ) +- `3, 7, 8, 5, 11, 10, 2, 9` (ఊరికే ఏదో ఒకటి) + +## ఎక్కడ వాడతారు + +Topological sorting ని ఎక్కువగా వాడేది — పనులు ఒకదానిమీద ఒకటి ఎలా ఆధారపడి ఉన్నాయో చూసి +**jobs లేదా tasks ని ఏ వరుసలో చేయాలో schedule చేయడానికి**. Jobs ని vertices గా చూపిస్తాం, +job `y` మొదలుపెట్టే ముందు job `x` అయిపోవాలంటే `x` నుంచి `y` కి ఒక edge పెడతాం (ఉదాహరణకి, +బట్టలు ఉతికేటప్పుడు, washing machine పని అయిపోయాకే బట్టల్ని dryer లో వేస్తాం). అప్పుడు topological sort +మనకి ఆ jobs ఏ వరుసలో చేయాలో చెప్తుంది. + +ఇంకో ఉపయోగం **dependency resolution**. ప్రతి vertex ఒక package, ప్రతి edge అంటే package `a` +అనేది package 'b' మీద ఆధారపడి ఉంది అని. అప్పుడు topological sorting dependencies ని install +చేయడానికి ఒక వరుస ఇస్తుంది — ప్రతి dependency ని install చేసే ముందే దానికి కావాల్సిన packages +install అయిపోయి ఉంటాయి. + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Topological_sorting) +- [YouTube లో Tushar Roy - Topological Sorting](https://www.youtube.com/watch?v=ddTC4Zovtbc&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/graph/travelling-salesman/README.md b/src/algorithms/graph/travelling-salesman/README.md index 6690cd47ad..cee50a9862 100644 --- a/src/algorithms/graph/travelling-salesman/README.md +++ b/src/algorithms/graph/travelling-salesman/README.md @@ -1,5 +1,8 @@ # Travelling Salesman Problem +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + The travelling salesman problem (TSP) asks the following question: "Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city diff --git a/src/algorithms/graph/travelling-salesman/README.tel-IN.md b/src/algorithms/graph/travelling-salesman/README.tel-IN.md new file mode 100644 index 0000000000..3cc91a87fd --- /dev/null +++ b/src/algorithms/graph/travelling-salesman/README.tel-IN.md @@ -0,0 +1,26 @@ +# Travelling Salesman Problem + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Travelling salesman problem (TSP) అడిగే ప్రశ్న ఇది: +"కొన్ని సిటీల list, ప్రతి రెండు సిటీల మధ్య దూరం ఇస్తే — ప్రతి సిటీకి ఒక్కసారి వెళ్ళి, +మళ్ళీ మొదలుపెట్టిన సిటీకి తిరిగొచ్చే అతి చిన్న route ఏది?" + +![Travelling Salesman](https://upload.wikimedia.org/wikipedia/commons/1/11/GLPK_solution_of_a_travelling_salesman_problem.svg) + +ఒక travelling salesman problem కి solution: నల్ల గీత అనేది ప్రతి ఎర్ర చుక్కని కలిపే +అతి చిన్న loop. + +![Travelling Salesman Graph](https://upload.wikimedia.org/wikipedia/commons/3/30/Weighted_K4.svg) + +TSP ని ఒక undirected weighted graph గా చూపించొచ్చు — సిటీలు graph లో vertices, దారులు +graph లో edges, ఒక దారి దూరం ఆ edge యొక్క weight. ఇది ఒక minimization problem — +ఒక fixed vertex దగ్గర మొదలుపెట్టి, మిగతా ప్రతి vertex ని సరిగ్గా ఒక్కసారి visit చేసి, +మళ్ళీ అదే vertex దగ్గర ముగించాలి. చాలాసార్లు ఈ model ఒక complete graph గా ఉంటుంది (అంటే +ప్రతి జత vertices ని ఒక edge కలుపుతుంది). రెండు సిటీల మధ్య దారి లేకపోతే, బాగా పొడవైన +ఒక edge కలిపితే graph complete అవుతుంది, best tour మీద ఏ ఎఫెక్ట్ ఉండదు. + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Travelling_salesman_problem) diff --git a/src/algorithms/image-processing/seam-carving/README.md b/src/algorithms/image-processing/seam-carving/README.md index 6eee9fe6ca..b860283cf1 100644 --- a/src/algorithms/image-processing/seam-carving/README.md +++ b/src/algorithms/image-processing/seam-carving/README.md @@ -1,5 +1,8 @@ # Content-aware image resizing in JavaScript +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + ![Content-aware image resizing in JavaScript](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/01-cover-02.png) > There is an [interactive version of this post](https://trekhleb.dev/blog/2021/content-aware-image-resizing-in-javascript/) available where you can upload and resize your custom images. diff --git a/src/algorithms/image-processing/seam-carving/README.tel-IN.md b/src/algorithms/image-processing/seam-carving/README.tel-IN.md new file mode 100644 index 0000000000..7e2ec9552c --- /dev/null +++ b/src/algorithms/image-processing/seam-carving/README.tel-IN.md @@ -0,0 +1,512 @@ +# JavaScript లో Content-aware image resizing + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +![Content-aware image resizing in JavaScript](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/01-cover-02.png) + +> ఈ post కి ఒక [interactive version](https://trekhleb.dev/blog/2021/content-aware-image-resizing-in-javascript/) కూడా ఉంది — అక్కడ మీ సొంత images upload చేసి resize చేసి చూడొచ్చు. + +## TL;DR + +*Seam Carving algorithm* గురించి ఇప్పటికే చాలా మంచి articles ఉన్నాయి. కానీ ఇంత అందంగా, powerful గా, *అయినా సింపుల్ గా* ఉండే ఈ algorithm ని నేనే స్వయంగా explore చేసి, నా experience గురించి రాయాలి అనే కోరిక ఆపుకోలేకపోయాను. ఇంకో విషయం నన్ను ఆకర్షించింది ([javascript-algorithms](https://github.com/trekhleb/javascript-algorithms) repo తయారుచేసిన వాడిగా) — దీన్ని solve చేయడానికి *Dynamic Programming (DP)* approach చక్కగా సరిపోతుంది. మీరు కూడా నాలాగే ఇంకా "algorithms నేర్చుకునే" journey లో ఉంటే, ఈ solution మీ DP ఆయుధాలకి ఇంకొకటి కలుపుతుంది. + +కాబట్టి, ఈ article తో నేను మూడు పనులు చేయాలనుకుంటున్నాను: + +1. మీ సొంత images ని resize చేసి ఆడుకోడానికి ఒక interactive **content-aware resizer** ఇవ్వడం +2. **Seam Carving algorithm** వెనక ఉన్న ఐడియా explain చేయడం +3. ఈ algorithm ని implement చేయడానికి **dynamic programming approach** explain చేయడం (దీనికి TypeScript వాడతాం) + +### Content-aware image resizing + +Image proportions మార్చాల్సి వచ్చినప్పుడు (అంటే height అలాగే ఉంచి width తగ్గించడం లాంటివి), ఇంకా image లో కొన్ని భాగాలు పోవడం మనకి ఇష్టం లేనప్పుడు *content-aware image resizing* వాడొచ్చు. ఇలాంటప్పుడు డైరెక్ట్ గా image ని scale చేస్తే, అందులో ఉన్న objects షేప్ పాడైపోతుంది. Image proportions మార్చేటప్పుడు objects proportions పాడవకుండా ఉండటానికి *Shai Avidan*, *Ariel Shamir* తీసుకొచ్చిన [Seam Carving algorithm](https://perso.crans.org/frenoy/matlab2012/seamcarving.pdf) వాడొచ్చు. + +కింద example లో, original image width ని *content-aware resizing* (ఎడమ image) తో, *డైరెక్ట్ scaling* (కుడి image) తో 50% తగ్గించారు. ఈ case లో ఎడమ image ఎక్కువ natural గా కనిపిస్తుంది, ఎందుకంటే balloons proportions అలాగే ఉన్నాయి. + +![Content-aware image resizing](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/01-resizing-options.png) + +Seam Carving algorithm ఐడియా ఏంటంటే — image content కి అతి తక్కువ contribution ఇచ్చే *seam* (వరుసగా కలిసి ఉన్న pixels) ని కనుక్కుని, దాన్ని *carve* (తీసేయడం) చేయడం. మనకి కావాల్సిన image width లేదా height వచ్చేదాకా ఇదే మళ్ళీ మళ్ళీ చేస్తాం. కింద example లో చూడొచ్చు — hot air balloon pixels, ఆకాశం pixels కంటే image content కి ఎక్కువ contribute చేస్తాయి. అందుకే ముందు ఆకాశం pixels తీసేస్తారు. + +![JS IMAGE CARVER DEMO](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/10-demo-01.gif) + +అతి తక్కువ energy ఉన్న seam ని కనుక్కోవడం computer కి చాలా భారమైన పని (ముఖ్యంగా పెద్ద images కి). Seam search ఫాస్ట్ గా చేయడానికి *dynamic programming* approach వాడొచ్చు (implementation details కింద చూద్దాం). + +### Objects తీసేయడం + +ప్రతి pixel ఎంత ముఖ్యం (దీన్నే pixel's energy అంటారు) అనేది, దాని color (`R`, `G`, `B`, `A`) కి పక్కన ఉన్న రెండు neighbor pixels color కి ఉన్న తేడాని బట్టి లెక్కపెడతాం. ఇప్పుడు, మనమే కావాలని కొన్ని pixels energy ని బాగా తక్కువగా పెట్టేస్తే (అంటే వాటి మీద ఒక mask గీస్తే), Seam Carving algorithm మనకి ఫ్రీగా **object removal** చేసి పెడుతుంది. + +![JS IMAGE CARVER OBJECT REMOVAL DEMO](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/10-demo-02.gif) + +### JS IMAGE CARVER demo + +నేను [JS IMAGE CARVER](https://trekhleb.dev/js-image-carver/) అనే web-app తయారుచేశాను (దాన్ని [GitHub లో open-source](https://github.com/trekhleb/js-image-carver) కూడా చేశాను). మీ సొంత images resize చేసి ఆడుకోడానికి దాన్ని వాడొచ్చు. + +### ఇంకొన్ని examples + +కొంచెం కష్టమైన backgrounds ని ఈ algorithm ఎలా handle చేస్తుందో చూపించే ఇంకొన్ని examples ఇవి. + +Background లో ఉన్న కొండలు ఎక్కడా seams కనిపించకుండా smooth గా చిన్నవయ్యాయి. + +![Resizing demo with more complex backgrounds](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/11-demo-01.png) + +సముద్రం అలలకి కూడా అంతే. Surfers షేప్ పాడవకుండా, అలల structure ని algorithm అలాగే ఉంచింది. + +![Resizing demo with more complex backgrounds](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/11-demo-02.png) + +ఒక విషయం గుర్తుపెట్టుకోవాలి — Seam Carving algorithm అన్నిటికీ పనిచేసే మంత్రం కాదు. *ఎక్కువ pixels edges గా ఉండే* (algorithm కి ముఖ్యమైనవిగా కనిపించే) images ని resize చేయడంలో ఇది fail అవ్వొచ్చు. అలాంటప్పుడు image లో ముఖ్యమైన భాగాలు కూడా పాడవడం మొదలవుతుంది. కింద example లో content-aware resizing కూడా దాదాపు డైరెక్ట్ scaling లాగానే ఉంది — ఎందుకంటే algorithm కి అన్ని pixels ముఖ్యమైనవిగానే కనిపిస్తున్నాయి, Van Gogh ముఖాన్ని background నుంచి వేరు చేయడం దానికి కష్టం. + +![Example when the algorithm does not work as expected](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/12-demo-01.png) + +## Seam Carving algorithm ఎలా పనిచేస్తుంది + +మన దగ్గర `1000 x 500 px` ఫోటో ఉంది, దాన్ని square చేయడానికి `500 x 500 px` కి మార్చాలి అనుకుందాం (square ratio అయితే Instagram feed కి బాగా సరిపోతుంది అనుకుందాం). ఇలాంటప్పుడు **resize చేసేటప్పుడు కొన్ని conditions** పెట్టుకోవాలి అనిపిస్తుంది: + +- *Image లో ముఖ్యమైన భాగాలు పోకూడదు* (అంటే resize చేసే ముందు 5 చెట్లు ఉంటే, resize చేశాక కూడా 5 చెట్లు ఉండాలి). +- Image లో ముఖ్యమైన భాగాల *proportions పాడవకూడదు* (అంటే గుండ్రంగా ఉండే car wheels నొక్కినట్టు oval గా అయిపోకూడదు) + +Image లో ముఖ్యమైన భాగాలు మారకుండా ఉండటానికి, పై నుంచి కిందకి వెళ్ళే, image content కి *అతి తక్కువ contribution* ఇచ్చే (ముఖ్యమైన భాగాలని తప్పించుకుని వెళ్ళే) **వరుసగా కలిసి ఉన్న pixels (seam)** ని కనుక్కుని, దాన్ని తీసేయొచ్చు. ఒక seam తీసేస్తే image 1 pixel చిన్నదవుతుంది. Image కి కావాల్సిన width వచ్చేదాకా ఈ step ని మళ్ళీ మళ్ళీ చేస్తాం. + +ఇక్కడ ప్రశ్న ఏంటంటే — *pixel ఎంత ముఖ్యం*, content కి దాని contribution ఎంత అని ఎలా నిర్ణయించాలి (original paper లో authors దీనికి **energy of the pixel** అనే పదం వాడారు). దీనికి ఒక పద్ధతి ఏంటంటే — edges ని ఏర్పరిచే pixels అన్నీ ముఖ్యమైనవిగా చూడటం. ఒక pixel edge లో భాగమైతే, దాని color కి neighbors (ఎడమ, కుడి pixels) color కి ఉన్న తేడా, edge లో భాగం కాని pixel కంటే ఎక్కువగా ఉంటుంది. + +![Pixels color difference](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/30-pixel-energy-comparison.png) + +ఒక pixel color ని *4* నంబర్లతో (`R` - red, `G` - green, `B` - blue, `A` - alpha) చూపిస్తారు అనుకుంటే, color తేడా (pixel energy) లెక్కపెట్టడానికి ఈ formula వాడొచ్చు: + +![Pixel energy formula](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/20-energy-formula.png) + +ఇక్కడ: + +- `mEnergy` - *మధ్య* pixel యొక్క *Energy* (ఎంత ముఖ్యం) (round చేస్తే `[0..626]`) +- `lR` - *ఎడమ* pixel యొక్క *Red* channel value (`[0..255]`) +- `mR` - *మధ్య* pixel యొక్క *Red* channel value (`[0..255]`) +- `rR` - *కుడి* pixel యొక్క *Red* channel value (`[0..255]`) +- `lG` - *ఎడమ* pixel యొక్క *Green* channel value (`[0..255]`) +- అలా మిగతావి... + +పైన formula లో ప్రస్తుతానికి alpha (transparency) channel ని వదిలేస్తున్నాం — image లో transparent pixels ఏమీ లేవు అనుకుంటున్నాం. తర్వాత masking కి, object removal కి alpha channel ని వాడతాం. + +![Example of pixel energy calculation](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/30-pixel-energy-calculation-example.png) + +ఇప్పుడు ఒక pixel energy ఎలా కనుక్కోవాలో తెలుసు కాబట్టి, **energy map** లెక్కపెట్టొచ్చు — అందులో image లో ప్రతి pixel energy ఉంటుంది. Resize చేసే ప్రతి step లో energy map ని మళ్ళీ లెక్కపెట్టాలి (కనీసం కొంత భాగమైనా, దాని గురించి కింద చెప్తా), దాని సైజ్ image సైజ్ తో సమానంగా ఉంటుంది. + +ఉదాహరణకి, resize చేసే 1st step లో మన దగ్గర `1000 x 500` image, `1000 x 500` energy map ఉంటాయి. 2nd step లో image నుంచి seam తీసేసి, కొత్తగా చిన్నదైన image మీద energy map మళ్ళీ లెక్కపెడతాం. అప్పుడు `999 x 500` image, `999 x 500` energy map వస్తాయి. + +Pixel energy ఎంత ఎక్కువ ఉంటే, అది edge లో భాగమయ్యే chance అంత ఎక్కువ — అంటే image content కి అది ముఖ్యం, దాన్ని తీసేయాల్సిన అవసరం అంత తక్కువ. + +Energy map ని చూడటానికి, ఎక్కువ energy ఉన్న pixels కి brightగా ఉండే color, తక్కువ energy ఉన్న pixels కి dark colors ఇవ్వొచ్చు. Energy map లో ఏదో ఒక భాగం ఎలా ఉండొచ్చో చూపించే ఒక కల్పిత example ఇది. ఇందులో ఒక bright line కనిపిస్తుంది — అది edge, resize చేసేటప్పుడు దాన్ని అలాగే ఉంచాలి. + +![Energy map sketch](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/30-energy-map-padding.png) + +పైన చూసిన demo image (hot air balloons ఉన్నది) కి నిజమైన energy map ఇది. + +![Energy map example](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/40-energy-map.png) + +మీ సొంత images తో energy map ఎలా కనిపిస్తుందో [post యొక్క interactive version](https://trekhleb.dev/blog/2021/content-aware-image-resizing-in-javascript/) లో చూడొచ్చు. + +Energy map వాడి అతి తక్కువ energy ఉన్న seams ని (ఒకదాని తర్వాత ఒకటి) కనుక్కోవచ్చు, దాంతో చివరికి ఏ pixels ని డిలీట్ చేయాలో నిర్ణయించొచ్చు. + +![Searching the seam](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/41-seam-search.png) + +అతి తక్కువ energy ఉన్న seam కనుక్కోవడం అంత ఈజీ కాదు — నిర్ణయం తీసుకునే ముందు చాలా pixel combinations చూడాలి. దీన్ని ఫాస్ట్ చేయడానికి dynamic programming approach వాడతాం. + +కింద example లో energy map, దానికి దొరికిన మొదటి lowest energy seam చూడొచ్చు. + +![Energy map example with seam](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/40-energy-map-with-seam.png) + +పైన examples లో image width తగ్గించాం. Image height తగ్గించడానికి కూడా ఇలాంటి పద్ధతే వాడొచ్చు. కానీ approach ని "తిప్పాలి": + +- Pixel energy లెక్కపెట్టడానికి *ఎడమ*, *కుడి* neighbors బదులు *పైన*, *కింద* ఉన్న neighbors వాడాలి +- Seam కోసం వెతికేటప్పుడు *పై* నుంచి *కిందకి* బదులు *ఎడమ* నుంచి *కుడికి* వెళ్ళాలి + +## TypeScript లో Implementation + +> Source code, కింద చెప్పిన functions అన్నీ [js-image-carver](https://github.com/trekhleb/js-image-carver) repository లో దొరుకుతాయి. + +Algorithm implement చేయడానికి TypeScript వాడతాం. మీకు JavaScript version కావాలంటే, type definitions, వాటిని వాడిన చోట్లని వదిలేయొచ్చు (తీసేయొచ్చు). + +సింపుల్ గా ఉండటానికి, seam carving algorithm ని image *width* తగ్గించడానికి మాత్రమే implement చేద్దాం. + +### Content-aware width resizing (entry function) + +ముందు, algorithm implement చేసేటప్పుడు వాడబోయే కొన్ని common types define చేద్దాం. + +```typescript +// Type that describes the image size (width and height). +type ImageSize = { w: number, h: number }; + +// The coordinate of the pixel. +type Coordinate = { x: number, y: number }; + +// The seam is a sequence of pixels (coordinates). +type Seam = Coordinate[]; + +// Energy map is a 2D array that has the same width and height +// as the image the map is being calculated for. +type EnergyMap = number[][]; + +// Type that describes the image pixel's RGBA color. +type Color = [ + r: number, // Red + g: number, // Green + b: number, // Blue + a: number, // Alpha (transparency) +] | Uint8ClampedArray; +``` + +పైపైన చూస్తే algorithm లో ఈ steps ఉంటాయి: + +1. Image యొక్క ఇప్పటి version కి **energy map** లెక్కపెట్టడం. +2. Energy map ని బట్టి అతి తక్కువ energy ఉన్న **seam** కనుక్కోవడం (ఇక్కడే Dynamic Programming వాడతాం). +3. అతి తక్కువ energy ఉన్న ఆ **seam ని image నుంచి డిలీట్ చేయడం**. +4. Image width కావాల్సిన value కి తగ్గేదాకా **మళ్ళీ మళ్ళీ చేయడం**. + +```typescript +type ResizeImageWidthArgs = { + img: ImageData, // Image data we want to resize. + toWidth: number, // Final image width we want the image to shrink to. +}; + +type ResizeImageWidthResult = { + img: ImageData, // Resized image data. + size: ImageSize, // Resized image size (w x h). +}; + +// Performs the content-aware image width resizing using the seam carving method. +export const resizeImageWidth = ( + { img, toWidth }: ResizeImageWidthArgs, +): ResizeImageWidthResult => { + // For performance reasons we want to avoid changing the img data array size. + // Instead we'll just keep the record of the resized image width and height separately. + const size: ImageSize = { w: img.width, h: img.height }; + + // Calculating the number of pixels to remove. + const pxToRemove = img.width - toWidth; + if (pxToRemove < 0) { + throw new Error('Upsizing is not supported for now'); + } + + let energyMap: EnergyMap | null = null; + let seam: Seam | null = null; + + // Removing the lowest energy seams one by one. + for (let i = 0; i < pxToRemove; i += 1) { + // 1. Calculate the energy map for the current version of the image. + energyMap = calculateEnergyMap(img, size); + + // 2. Find the seam with the lowest energy based on the energy map. + seam = findLowEnergySeam(energyMap, size); + + // 3. Delete the seam with the lowest energy seam from the image. + deleteSeam(img, seam, size); + + // Reduce the image width, and continue iterations. + size.w -= 1; + } + + // Returning the resized image and its final size. + // The img is actually a reference to the ImageData, so technically + // the caller of the function already has this pointer. But let's + // still return it for better code readability. + return { img, size }; +}; +``` + +Resize చేయాల్సిన image ని function కి [ImageData](https://developer.mozilla.org/en-US/docs/Web/API/ImageData) format లో పంపిస్తాం. Image ని canvas మీద గీసి, canvas నుంచి ImageData ని ఇలా తీసుకోవచ్చు: + +```javascript +const ctx = canvas.getContext('2d'); +const imgData = ctx.getImageData(0, 0, imgWidth, imgHeight); +``` + +> JavaScript లో images ని upload చేయడం, గీయడం ఈ article పరిధిలో లేదు, కానీ React వాడి ఎలా చేయొచ్చో పూర్తి source code [js-image-carver](https://github.com/trekhleb/js-image-carver) repo లో దొరుకుతుంది. + +ఇప్పుడు ఒక్కో step ని విడదీసి చూసి `calculateEnergyMap()`, `findLowEnergySeam()`, `deleteSeam()` functions implement చేద్దాం. + +### Pixel energy లెక్కపెట్టడం + +ఇక్కడ పైన చెప్పిన color తేడా formula వాడతాం. ఎడమ, కుడి అంచుల దగ్గర (ఎడమ గానీ కుడి గానీ neighbors లేనప్పుడు), ఆ neighbors ని పట్టించుకోము, energy లెక్కలోకి తీసుకోము. + +```typescript +// Calculates the energy of a pixel. +const getPixelEnergy = (left: Color | null, middle: Color, right: Color | null): number => { + // Middle pixel is the pixel we're calculating the energy for. + const [mR, mG, mB] = middle; + + // Energy from the left pixel (if it exists). + let lEnergy = 0; + if (left) { + const [lR, lG, lB] = left; + lEnergy = (lR - mR) ** 2 + (lG - mG) ** 2 + (lB - mB) ** 2; + } + + // Energy from the right pixel (if it exists). + let rEnergy = 0; + if (right) { + const [rR, rG, rB] = right; + rEnergy = (rR - mR) ** 2 + (rG - mG) ** 2 + (rB - mB) ** 2; + } + + // Resulting pixel energy. + return Math.sqrt(lEnergy + rEnergy); +}; +``` + +### Energy map లెక్కపెట్టడం + +మనం పనిచేస్తున్న image [ImageData](https://developer.mozilla.org/en-US/docs/Web/API/ImageData) format లో ఉంది. అంటే అన్ని pixels (వాటి colors) ఒక flat (*1D*) [Uint8ClampedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray) array లో store అయి ఉంటాయి. చదవడానికి ఈజీగా ఉండటానికి, Uint8ClampedArray array తో ఒక *2D* matrix లాగా పనిచేయడానికి రెండు helper functions తీసుకొద్దాం. + +```typescript +// Helper function that returns the color of the pixel. +const getPixel = (img: ImageData, { x, y }: Coordinate): Color => { + // The ImageData data array is a flat 1D array. + // Thus we need to convert x and y coordinates to the linear index. + const i = y * img.width + x; + const cellsPerColor = 4; // RGBA + // For better efficiency, instead of creating a new sub-array we return + // a pointer to the part of the ImageData array. + return img.data.subarray(i * cellsPerColor, i * cellsPerColor + cellsPerColor); +}; + +// Helper function that sets the color of the pixel. +const setPixel = (img: ImageData, { x, y }: Coordinate, color: Color): void => { + // The ImageData data array is a flat 1D array. + // Thus we need to convert x and y coordinates to the linear index. + const i = y * img.width + x; + const cellsPerColor = 4; // RGBA + img.data.set(color, i * cellsPerColor); +}; +``` + +Energy map లెక్కపెట్టడానికి image లో ప్రతి pixel దగ్గరికి వెళ్ళి, దాని మీద ఇంతకుముందు చెప్పిన `getPixelEnergy()` function ని call చేస్తాం. + +```typescript +// Helper function that creates a matrix (2D array) of specific +// size (w x h) and fills it with specified value. +const matrix = (w: number, h: number, filler: T): T[][] => { + return new Array(h) + .fill(null) + .map(() => { + return new Array(w).fill(filler); + }); +}; + +// Calculates the energy of each pixel of the image. +const calculateEnergyMap = (img: ImageData, { w, h }: ImageSize): EnergyMap => { + // Create an empty energy map where each pixel has infinitely high energy. + // We will update the energy of each pixel. + const energyMap: number[][] = matrix(w, h, Infinity); + for (let y = 0; y < h; y += 1) { + for (let x = 0; x < w; x += 1) { + // Left pixel might not exist if we're on the very left edge of the image. + const left = (x - 1) >= 0 ? getPixel(img, { x: x - 1, y }) : null; + // The color of the middle pixel that we're calculating the energy for. + const middle = getPixel(img, { x, y }); + // Right pixel might not exist if we're on the very right edge of the image. + const right = (x + 1) < w ? getPixel(img, { x: x + 1, y }) : null; + energyMap[y][x] = getPixelEnergy(left, middle, right); + } + } + return energyMap; +}; +``` + +> Resize చేసే ప్రతి iteration లో energy map ని మళ్ళీ లెక్కపెడతాం. అంటే, image ని 500 pixels తగ్గించాలంటే 500 సార్లు లెక్కపెడతాం — ఇది అంత మంచిది కాదు. 2nd, 3rd, ఇంకా తర్వాత steps లో energy map ఫాస్ట్ గా లెక్కపెట్టడానికి, తీసేయబోయే seam చుట్టూ ఉన్న pixels కి మాత్రమే energy మళ్ళీ లెక్కపెట్టొచ్చు. సింపుల్ గా ఉండటానికి ఈ optimization ని ఇక్కడ వదిలేశాం, కానీ example source-code [js-image-carver](https://github.com/trekhleb/js-image-carver) repo లో దొరుకుతుంది. + +### అతి తక్కువ energy ఉన్న seam కనుక్కోవడం (Dynamic Programming approach) + +> ఇంతకుముందు [Dynamic Programming vs Divide-and-Conquer](https://trekhleb.dev/blog/2018/dynamic-programming-vs-divide-and-conquer/) article లో Dynamic Programming బేసిక్స్ కొన్ని చెప్పాను. అక్కడ minimum edit distance problem మీద ఒక DP example ఉంది. ఇంకొంచెం context కావాలంటే అది చూడొచ్చు. + +ఇప్పుడు మనం solve చేయాల్సిన problem ఏంటంటే — energy map మీద పై నుంచి కిందకి వెళ్ళే, pixel energies మొత్తం అతి తక్కువగా ఉండే path (seam) కనుక్కోవడం. + +#### Naive approach + +Naive approach అంటే అన్ని possible paths ని ఒకదాని తర్వాత ఒకటి చెక్ చేయడం. + +![The naive approach](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/50-naive-approach.png) + +పై నుంచి కిందకి వెళ్తుంటే, ప్రతి pixel కి 3 options ఉంటాయి (↙︎ కింద-ఎడమకి, ↓ కిందకి, ↘︎ కింద-కుడికి). దాంతో time complexity `O(w * 3^h)` లేదా సింపుల్ గా `O(3^h)` వస్తుంది — ఇక్కడ `w`, `h` అంటే image యొక్క width, height. ఈ approach slow గా ఉంటుంది. + +#### Greedy approach + +ప్రతిసారి next pixel గా అతి తక్కువ energy ఉన్న pixel ని ఎంచుకుంటూ వెళ్ళొచ్చు — చివరికి వచ్చే seam energy కూడా అతి తక్కువగా ఉంటుంది అని ఆశిస్తూ. + +![The greedy approach](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/51-greedy-approach.png) + +ఈ approach మరీ worst solution ఇవ్వదు, కానీ ఉన్నవాటిలో best solution దొరుకుతుంది అని guarantee ఇవ్వలేదు. పైన image లో చూడొచ్చు — greedy approach మొదట్లో `10` బదులు `5` ఎంచుకుని, best pixels chain ని miss అయింది. + +ఈ approach లో మంచి విషయం ఏంటంటే ఇది ఫాస్ట్ — దీని time complexity `O(w + h)`, ఇక్కడ `w`, `h` అంటే image యొక్క width, height. కానీ ఈ speed కి మనం కట్టే మూల్యం resize quality తక్కువగా ఉండటం. మొదటి row లో minimum value కనుక్కోవాలి (`w` cells చూడాలి), తర్వాత ప్రతి row లో 3 neighbor pixels మాత్రమే చూస్తాం (`h` rows). + +#### Dynamic programming approach + +మీరు గమనించే ఉంటారు — naive approach లో seams energy లెక్కపెట్టేటప్పుడు, ఒకే pixel energies ని మళ్ళీ మళ్ళీ కలుపుతున్నాం. + +![Repeated problems](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/52-dp-repeated-problems.png) + +పైన example లో చూడొచ్చు — మొదటి రెండు seams కోసం చిన్న seam (energy `235` ఉన్నది) energy నే మళ్ళీ వాడుతున్నాం. 2nd seam energy లెక్కపెట్టడానికి `235 + 70` అని ఒక్క operation చేయకుండా, `(5 + 0 + 80 + 150) + 70` అని నాలుగు operations చేస్తున్నాం. + +> ఇప్పటి seam energy లెక్కపెట్టడానికి ముందు seam energy ని వాడుకుంటున్నాం అనే విషయం, పైన ఉన్న 1st row seam వరకు అన్ని చిన్న seams కి recursive గా వర్తిస్తుంది. ఇలా ఒకదానితో ఒకటి overlap అయ్యే sub-problems ఉన్నప్పుడు, ఆ problem ని dynamic programming approach తో optimize *చేయొచ్చు* అనడానికి [అది ఒక సూచన](https://trekhleb.dev/blog/2018/dynamic-programming-vs-divide-and-conquer/). + +కాబట్టి, ఒక particular pixel దగ్గర **ఇప్పటి seam energy ని** ఇంకో `seamsEnergies` table లో **save చేయొచ్చు** — దాంతో next seams ని ఫాస్ట్ గా లెక్కపెట్టడానికి మళ్ళీ వాడుకోవచ్చు (`seamsEnergies` table సైజ్ energy map, image సైజ్ తో సమానంగా ఉంటుంది). + +ఇంకో విషయం గుర్తుపెట్టుకుందాం — image లో ఒక particular pixel కి (ఉదాహరణకి కింద ఎడమ మూలలో ఉన్నది) ముందు seams energies కి *చాలా* values ఉండొచ్చు. + +![What seam to choose](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/53-dp-what-to-choose.png) + +మనం అతి తక్కువ energy ఉన్న seam కోసం వెతుకుతున్నాం కాబట్టి, ముందు seam కూడా అతి తక్కువ energy ఉన్నదే ఎంచుకోవడం కరెక్ట్. + +![Seams energies example](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/56-dp-seams-energies-example.png) + +మామూలుగా, ఎంచుకోడానికి మూడు possible ముందు seams ఉంటాయి: + +![Three options to choose from](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/55-dp-three-options.png) + +దీన్ని ఇలా ఆలోచించొచ్చు: + +- Cell `[1][x]`: row `[0][?]` లో ఎక్కడో మొదలై cell `[1][x]` దగ్గర ముగిసే seam కి వీలైనంత తక్కువ energy ఇందులో ఉంటుంది +- **ఇప్పటి cell** `[2][3]`: row `[0][?]` లో ఎక్కడో మొదలై cell `[2][3]` దగ్గర ముగిసే seam కి వీలైనంత తక్కువ energy ఇందులో ఉంటుంది. దీన్ని లెక్కపెట్టడానికి ఇప్పటి pixel `[2][3]` energy (energy map నుంచి) ని `min(seam_energy_1_2, seam_energy_1_3, seam_energy_1_4)` తో కలపాలి + +`seamsEnergies` table మొత్తం నింపేస్తే, అన్నిటికంటే కింద row లో ఉన్న minimum నంబరే వీలైనంత తక్కువ seam energy. + +ఇది ఎలా పనిచేస్తుందో చూడటానికి ఈ table లో కొన్ని cells నింపి చూద్దాం. + +![Seams energies map traversal](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/57-dp-seams-energies-traversal.png) + +`seamsEnergies` table నింపేశాక, అతి తక్కువ energy ఉన్న pixel energy `50` అని చూడొచ్చు. సౌలభ్యం కోసం, `seamsEnergies` తయారుచేసేటప్పుడు ప్రతి pixel కి seam energy మాత్రమే కాకుండా, ముందు ఉన్న lowest energy seam coordinates కూడా save చేయొచ్చు. దాంతో seam path ని కింద నుంచి పైకి ఈజీగా మళ్ళీ కట్టొచ్చు. + +DP approach time complexity `O(w * h)`, ఇక్కడ `w`, `h` అంటే image యొక్క width, height. Image లో *ప్రతి* pixel కి energies లెక్కపెట్టాలి. + +ఈ logic ని ఎలా implement చేయొచ్చో ఒక example ఇది: + +```typescript +// The metadata for the pixels in the seam. +type SeamPixelMeta = { + energy: number, // The energy of the pixel. + coordinate: Coordinate, // The coordinate of the pixel. + previous: Coordinate | null, // The previous pixel in a seam. +}; + +// Finds the seam (the sequence of pixels from top to bottom) that has the +// lowest resulting energy using the Dynamic Programming approach. +const findLowEnergySeam = (energyMap: EnergyMap, { w, h }: ImageSize): Seam => { + // The 2D array of the size of w and h, where each pixel contains the + // seam metadata (pixel energy, pixel coordinate and previous pixel from + // the lowest energy seam at this point). + const seamsEnergies: (SeamPixelMeta | null)[][] = matrix(w, h, null); + + // Populate the first row of the map by just copying the energies + // from the energy map. + for (let x = 0; x < w; x += 1) { + const y = 0; + seamsEnergies[y][x] = { + energy: energyMap[y][x], + coordinate: { x, y }, + previous: null, + }; + } + + // Populate the rest of the rows. + for (let y = 1; y < h; y += 1) { + for (let x = 0; x < w; x += 1) { + // Find the top adjacent cell with minimum energy. + // This cell would be the tail of a seam with lowest energy at this point. + // It doesn't mean that this seam (path) has lowest energy globally. + // Instead, it means that we found a path with the lowest energy that may lead + // us to the current pixel with the coordinates x and y. + let minPrevEnergy = Infinity; + let minPrevX: number = x; + for (let i = (x - 1); i <= (x + 1); i += 1) { + if (i >= 0 && i < w && seamsEnergies[y - 1][i].energy < minPrevEnergy) { + minPrevEnergy = seamsEnergies[y - 1][i].energy; + minPrevX = i; + } + } + + // Update the current cell. + seamsEnergies[y][x] = { + energy: minPrevEnergy + energyMap[y][x], + coordinate: { x, y }, + previous: { x: minPrevX, y: y - 1 }, + }; + } + } + + // Find where the minimum energy seam ends. + // We need to find the tail of the lowest energy seam to start + // traversing it from its tail to its head (from the bottom to the top). + let lastMinCoordinate: Coordinate | null = null; + let minSeamEnergy = Infinity; + for (let x = 0; x < w; x += 1) { + const y = h - 1; + if (seamsEnergies[y][x].energy < minSeamEnergy) { + minSeamEnergy = seamsEnergies[y][x].energy; + lastMinCoordinate = { x, y }; + } + } + + // Find the lowest energy seam. + // Once we know where the tail is we may traverse and assemble the lowest + // energy seam based on the "previous" value of the seam pixel metadata. + const seam: Seam = []; + if (!lastMinCoordinate) { + return seam; + } + + const { x: lastMinX, y: lastMinY } = lastMinCoordinate; + + // Adding new pixel to the seam path one by one until we reach the top. + let currentSeam = seamsEnergies[lastMinY][lastMinX]; + while (currentSeam) { + seam.push(currentSeam.coordinate); + const prevMinCoordinates = currentSeam.previous; + if (!prevMinCoordinates) { + currentSeam = null; + } else { + const { x: prevMinX, y: prevMinY } = prevMinCoordinates; + currentSeam = seamsEnergies[prevMinY][prevMinX]; + } + } + + return seam; +}; +``` + +### అతి తక్కువ energy ఉన్న seam ని తీసేయడం + +అతి తక్కువ energy ఉన్న seam దొరికాక, దాన్ని ఏర్పరిచే pixels ని image నుంచి తీసేయాలి (carve చేయాలి). Seam కి కుడి వైపు ఉన్న pixels ని `1px` ఎడమకి జరపడం ద్వారా ఇది జరుగుతుంది. Performance కోసం, చివరి columns ని నిజంగా డిలీట్ చేయము. బదులుగా, rendering component resize అయిన image width దాటిన భాగాన్ని పట్టించుకోదు అంతే. + +![Deleting the seam](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/60-deleting-example.png) + +```typescript +// Deletes the seam from the image data. +// We delete the pixel in each row and then shift the rest of the row pixels to the left. +const deleteSeam = (img: ImageData, seam: Seam, { w }: ImageSize): void => { + seam.forEach(({ x: seamX, y: seamY }: Coordinate) => { + for (let x = seamX; x < (w - 1); x += 1) { + const nextPixel = getPixel(img, { x: x + 1, y: seamY }); + setPixel(img, { x, y: seamY }, nextPixel); + } + }); +}; +``` + +## Objects తీసేయడం + +Seam Carving algorithm తక్కువ energy pixels ఉన్న seams ని ముందు తీసేయడానికి ట్రై చేస్తుంది. ఈ విషయాన్ని మనం వాడుకోవచ్చు — కొన్ని pixels కి మనమే తక్కువ energy ఇస్తే (అంటే image మీద గీసి కొన్ని ఏరియాలని mask చేస్తే), Seam Carving algorithm మనకి ఫ్రీగా *objects removal* చేసి పెడుతుంది. + +ప్రస్తుతం `getPixelEnergy()` function లో pixel energy లెక్కపెట్టడానికి `R`, `G`, `B` color channels మాత్రమే వాడుతున్నాం. కానీ color లో ఇంకా వాడని `A` (alpha, transparency) parameter కూడా ఉంది. Transparent pixels అంటే మనం తీసేయాలనుకునే pixels అని algorithm కి చెప్పడానికి transparency channel వాడొచ్చు. Transparency ని లెక్కలోకి తీసుకునే [energy function source-code](https://github.com/trekhleb/js-image-carver/blob/main/src/utils/contentAwareResizer.ts#L54) చూడొచ్చు. + +Object removal కి algorithm ఎలా పనిచేస్తుందో ఇక్కడ చూడండి. + +![JS IMAGE CARVER OBJECT REMOVAL DEMO](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/10-demo-02.gif) + +## Issues, ఇంకా తర్వాత ఏంటి + +[JS IMAGE CARVER](https://github.com/trekhleb/js-image-carver) web app నిజంగా production లో వాడేంత resizer కాదు. దీని ముఖ్య ఉద్దేశం Seam Carving algorithm తో interactive గా experiment చేయడం. కాబట్టి ముందు ముందు కూడా experiments కంటిన్యూ చేయాలనేదే plan. + +[Original paper](https://perso.crans.org/frenoy/matlab2012/seamcarving.pdf) లో Seam Carving algorithm ని images చిన్నవి చేయడానికి మాత్రమే కాకుండా, **images పెద్దవి చేయడానికి (upscaling)** కూడా ఎలా వాడొచ్చో చెప్పారు. Upscaling ని **objects తీసేశాక image ని మళ్ళీ original width కి పెంచడానికి** వాడొచ్చు. + +Experiment చేయడానికి ఇంకో interesting విషయం — algorithm ని **real-time** లో పనిచేసేలా చేయడం. + +> ఇవన్నీ ముందు ముందు plans, కానీ ప్రస్తుతానికి image చిన్నది చేసే example మీకు interesting గా, ఉపయోగకరంగా అనిపించిందని ఆశిస్తున్నాను. దీన్ని implement చేయడానికి dynamic programming ఎలా వాడాలో కూడా మీకు ఐడియా వచ్చిందని ఆశిస్తున్నాను. +> +> మీ సొంత experiments కి all the best! diff --git a/src/algorithms/linked-list/reverse-traversal/README.md b/src/algorithms/linked-list/reverse-traversal/README.md index 7e3f3cd6bb..da693b4e46 100644 --- a/src/algorithms/linked-list/reverse-traversal/README.md +++ b/src/algorithms/linked-list/reverse-traversal/README.md @@ -2,7 +2,8 @@ _Read this in other languages:_ [_中文_](README.zh-CN.md), -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) The task is to traverse the given linked list in reversed order. diff --git a/src/algorithms/linked-list/reverse-traversal/README.pt-BR.md b/src/algorithms/linked-list/reverse-traversal/README.pt-BR.md index b2761ad720..0ba1ce2054 100644 --- a/src/algorithms/linked-list/reverse-traversal/README.pt-BR.md +++ b/src/algorithms/linked-list/reverse-traversal/README.pt-BR.md @@ -2,7 +2,8 @@ _Leia isso em outros idiomas:_ [_中文_](README.zh-CN.md), -[_English_](README.md) +[_English_](README.md), +[_తెలుగు_](README.tel-IN.md) A tarefa é percorrer a lista encadeada fornecida em ordem inversa. diff --git a/src/algorithms/linked-list/reverse-traversal/README.tel-IN.md b/src/algorithms/linked-list/reverse-traversal/README.tel-IN.md new file mode 100644 index 0000000000..306ff2304b --- /dev/null +++ b/src/algorithms/linked-list/reverse-traversal/README.tel-IN.md @@ -0,0 +1,24 @@ +# Reversed Linked List Traversal + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_中文_](README.zh-CN.md), +[_Português_](README.pt-BR.md) + +ఇచ్చిన linked list ని తిరగేసి (వెనక నుంచి ముందుకి) traverse చేయాలి. + +ఉదాహరణకి, ఈ linked list తీసుకుంటే: + +![](https://upload.wikimedia.org/wikipedia/commons/6/6d/Singly-linked-list.svg) + +Traverse చేసే వరుస ఇలా ఉండాలి: + +```text +37 → 99 → 12 +``` + +ప్రతి node ని ఒక్కసారి మాత్రమే visit చేస్తాం కాబట్టి time complexity `O(n)`. + +## Reference + +- [Wikipedia](https://en.wikipedia.org/wiki/Linked_list) diff --git a/src/algorithms/linked-list/traversal/README.md b/src/algorithms/linked-list/traversal/README.md index 09b177494c..580ea492c4 100644 --- a/src/algorithms/linked-list/traversal/README.md +++ b/src/algorithms/linked-list/traversal/README.md @@ -3,7 +3,8 @@ _Read this in other languages:_ [_Русский_](README.ru-RU.md), [_中文_](README.zh-CN.md), -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) The task is to traverse the given linked list in straight order. diff --git a/src/algorithms/linked-list/traversal/README.pt-BR.md b/src/algorithms/linked-list/traversal/README.pt-BR.md index 0fae9ed01a..bb0688025e 100644 --- a/src/algorithms/linked-list/traversal/README.pt-BR.md +++ b/src/algorithms/linked-list/traversal/README.pt-BR.md @@ -3,7 +3,8 @@ _Leia isso em outros idiomas:_ [_Русский_](README.ru-RU.md), [_中文_](README.zh-CN.md), -[_English_](README.md) +[_English_](README.md), +[_తెలుగు_](README.tel-IN.md) A tarefa é percorrer a lista encadeada fornecida em ordem direta. diff --git a/src/algorithms/linked-list/traversal/README.tel-IN.md b/src/algorithms/linked-list/traversal/README.tel-IN.md new file mode 100644 index 0000000000..8b9956d3ed --- /dev/null +++ b/src/algorithms/linked-list/traversal/README.tel-IN.md @@ -0,0 +1,25 @@ +# Linked List Traversal + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Русский_](README.ru-RU.md), +[_中文_](README.zh-CN.md), +[_Português_](README.pt-BR.md) + +ఇచ్చిన linked list ని మామూలు (ముందు నుంచి వెనక్కి) వరుసలో traverse చేయాలి. + +ఉదాహరణకి, ఈ linked list తీసుకుంటే: + +![Singly linked list](https://upload.wikimedia.org/wikipedia/commons/6/6d/Singly-linked-list.svg) + +Traverse చేసే వరుస ఇలా ఉండాలి: + +```text +12 → 99 → 37 +``` + +ప్రతి node ని ఒక్కసారి మాత్రమే visit చేస్తాం కాబట్టి time complexity `O(n)`. + +## Reference + +- [Wikipedia](https://en.wikipedia.org/wiki/Linked_list) diff --git a/src/algorithms/math/binary-floating-point/README.md b/src/algorithms/math/binary-floating-point/README.md index d1ae72731e..a4a37b6eab 100644 --- a/src/algorithms/math/binary-floating-point/README.md +++ b/src/algorithms/math/binary-floating-point/README.md @@ -1,5 +1,8 @@ # Binary representation of floating-point numbers +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + Have you ever wondered how computers store the floating-point numbers like `3.1416` (𝝿) or `9.109 × 10⁻³¹` (the mass of the electron in kg) in the memory which is limited by a finite number of ones and zeroes (aka bits)? It seems pretty straightforward for integers (i.e. `17`). Let's say we have 16 bits (2 bytes) to store the number. In 16 bits we may store the integers in a range of `[0, 65535]`: diff --git a/src/algorithms/math/binary-floating-point/README.tel-IN.md b/src/algorithms/math/binary-floating-point/README.tel-IN.md new file mode 100644 index 0000000000..eaf2204977 --- /dev/null +++ b/src/algorithms/math/binary-floating-point/README.tel-IN.md @@ -0,0 +1,108 @@ +# Floating-point numbers యొక్క Binary representation + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Computers `3.1416` (𝝿) లేదా `9.109 × 10⁻³¹` (electron mass, kg లో) లాంటి floating-point numbers ని memory లో ఎలా store చేస్తాయో ఎప్పుడైనా ఆలోచించారా? Memory లో ఉండేది లిమిటెడ్ సంఖ్యలో ones, zeroes (అంటే bits) మాత్రమే కదా? + +Integers (ఉదాహరణకి `17`) కి అయితే ఇది చాలా ఈజీగా అనిపిస్తుంది. నంబర్ store చేయడానికి మన దగ్గర 16 bits (2 bytes) ఉన్నాయి అనుకుందాం. 16 bits లో `[0, 65535]` range లో ఉన్న integers store చేయొచ్చు: + +```text +(0000000000000000)₂ = (0)₁₀ + +(0000000000010001)₂ = + (1 × 2⁴) + + (0 × 2³) + + (0 × 2²) + + (0 × 2¹) + + (1 × 2⁰) = (17)₁₀ + +(1111111111111111)₂ = + (1 × 2¹⁵) + + (1 × 2¹⁴) + + (1 × 2¹³) + + (1 × 2¹²) + + (1 × 2¹¹) + + (1 × 2¹⁰) + + (1 × 2⁹) + + (1 × 2⁸) + + (1 × 2⁷) + + (1 × 2⁶) + + (1 × 2⁵) + + (1 × 2⁴) + + (1 × 2³) + + (1 × 2²) + + (1 × 2¹) + + (1 × 2⁰) = (65535)₁₀ +``` + +Signed integer (negative నంబర్లు కూడా) కావాలంటే, [two's complement](https://en.wikipedia.org/wiki/Two%27s_complement) వాడి `[0, 65535]` range ని negative నంబర్ల వైపు జరపొచ్చు. అప్పుడు మన 16 bits `[-32768, +32767]` range లో నంబర్లని చూపిస్తాయి. + +మీరు గమనించే ఉంటారు — ఈ పద్ధతిలో `-27.15625` లాంటి నంబర్లని చూపించలేం (decimal point తర్వాత ఉన్న నంబర్లని వదిలేస్తాం). + +ఈ problem ని గమనించింది మనం మొదటివాళ్ళం కాదు లెండి. దాదాపు ≈36 సంవత్సరాల క్రితం కొంతమంది తెలివైనవాళ్ళు floating-point arithmetic కోసం [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754) standard తీసుకొచ్చి ఈ limitation ని దాటారు. + +IEEE 754 standard ఆ 16 bits (లేదా 32, లేదా 64 bits) ని వాడి ఇంకా పెద్ద range లో నంబర్లని — చిన్న floating numbers (1 కంటే చిన్నవి, 0 కి దగ్గరగా ఉన్నవి) తో సహా — ఎలా store చేయాలో చెప్పే పద్ధతి (framework). + +ఈ standard వెనక ఐడియా అర్థమవ్వడానికి [scientific notation](https://en.wikipedia.org/wiki/Scientific_notation) గుర్తుచేసుకోవచ్చు — decimal form లో రాయడానికి కష్టంగా ఉండే మరీ పెద్ద లేదా మరీ చిన్న నంబర్లని (మామూలుగా రాస్తే చాలా పొడవైన digits వస్తాయి) చూపించే పద్ధతి అది. + +![Scientific number notation](images/03-scientific-notation.png) + +Image లో చూస్తే, నంబర్ ని మూడు భాగాలుగా విడగొట్టొచ్చు: + +- **sign** +- **fraction (దీన్నే significand అంటారు)** - నంబర్ లో విలువైన digits (అసలు అర్థం, payload) +- **exponent** - fraction లో decimal point ని ఎంత దూరం, ఏ వైపుకి జరపాలో చెప్తుంది + +**Base** భాగం ఎంత అనేది ముందే ఒప్పుకుంటే దాన్ని వదిలేయొచ్చు. మన case లో base గా `2` వాడతాం. + +మొత్తం 16 bits (లేదా 32 bits, లేదా 64 bits) ని నంబర్ fraction store చేయడానికే వాడకుండా, bits ని పంచుకుని sign, exponent, fraction మూడూ ఒకేసారి store చేయొచ్చు. నంబర్ store చేయడానికి ఎన్ని bits వాడతాం అనేదాన్ని బట్టి ఈ పంపకాలు వస్తాయి: + +| Floating-point format | మొత్తం bits | Sign bits | Exponent bits | Fraction bits | Base | +| :-------------------- | :--------: | :-------: | :-----------: | :--------------: | :--: | +| [Half-precision](https://en.wikipedia.org/wiki/Half-precision_floating-point_format) | 16 | 1 | 5 | 10 | 2 | +| [Single-precision](https://en.wikipedia.org/wiki/Single-precision_floating-point_format) | 32 | 1 | 8 | 23 | 2 | +| [Double-precision](https://en.wikipedia.org/wiki/Double-precision_floating-point_format) | 64 | 1 | 11 | 52 | 2 | + +ఈ పద్ధతిలో fraction కి bits తగ్గాయి (ఉదాహరణకి 16-bits నంబర్ కి 16 bits నుంచి 10 bits కి తగ్గింది). అంటే ఇప్పుడు fraction చిన్న range values మాత్రమే తీసుకోగలదు (కొంత precision పోతుంది). కానీ exponent భాగం కూడా ఉంది కాబట్టి, మొత్తం నంబర్ range నిజానికి పెరుగుతుంది, ఇంకా 0, 1 మధ్య నంబర్లని కూడా చూపించొచ్చు (exponent negative అయితే). + +> ఉదాహరణకి, signed 32-bit integer variable maximum value 2³¹ − 1 = 2,147,483,647, కానీ IEEE 754 32-bit base-2 floating-point variable maximum value ≈ 3.4028235 × 10³⁸. + +Exponent negative కూడా అవ్వడానికి, IEEE 754 standard [biased exponent](https://en.wikipedia.org/wiki/Exponent_bias) వాడుతుంది. ఐడియా సింపుల్ — exponent value నుంచి bias ని తీసేస్తే అది negative అవ్వొచ్చు. ఉదాహరణకి, exponent కి 5 bits ఉంటే, అది `[0, 31]` range లో values తీసుకోవచ్చు (ఇక్కడ అన్నీ positive). కానీ దాని నుంచి `15` తీసేస్తే, range `[-15, 16]` అవుతుంది. ఈ `15` నంబర్ ని bias అంటారు, దాన్ని ఈ formula తో లెక్కపెడతారు: + +``` +exponent_bias = 2 ^ (k−1) − 1 + +k - number of exponent bits +``` + +(ఇక్కడ `k` అంటే exponent bits సంఖ్య.) + +Floating-point numbers ని binary format నుంచి మళ్ళీ decimal format కి మార్చే logic ని కింద image లో చూపించడానికి ట్రై చేశాను. IEEE 754 standard ఎలా పనిచేస్తుందో దీంతో ఇంకా బాగా అర్థమవుతుందని ఆశిస్తున్నాను. సింపుల్ గా ఉండటానికి ఇక్కడ 16-bits నంబర్ వాడాం, కానీ 32-bits, 64-bits నంబర్లకి కూడా ఇదే పద్ధతి పనిచేస్తుంది. + +![Half-precision floating point number format explained in one picture](images/02-half-precision-floating-point-number-explained.png) + +> Bits ని on/off చేసి, final result మీద అది ఎలా ఎఫెక్ట్ చూపిస్తుందో చూడాలంటే [ఈ diagram interactive version](https://trekhleb.dev/blog/2021/binary-floating-point/) చూడండి + +వేరువేరు floating-point formats support చేసే నంబర్ ranges ఇవి: + +| Floating-point format | Exp min | Exp max | Range | Min positive | +| :-------------------- | :------ | :------ | :--------------- | :----------- | +| Half-precision | −14 | +15 | ±65,504 | 6.10 × 10⁻⁵ | +| Single-precision | −126 | +127 | ±3.4028235 × 10³⁸| 1.18 × 10⁻³⁸ | + +గుర్తుపెట్టుకోండి — ఇది IEEE 754 standard గురించి పూర్తి overview ఏమాత్రం కాదు. ఇది సింపుల్ గా, బేసిక్ గా ఇచ్చిన overview. సింపుల్ గా ఉండటానికి పైన examples లో కొన్ని corner cases వదిలేశాం (ఉదాహరణకి `-0`, `-∞`, `+∞`, `NaN` (not a number) values) + +## Code examples + +- Bits array ని floating point number గా ఎలా మార్చాలో example కోసం [bitsToFloat.js](bitsToFloat.js) చూడండి (example కొంచెం కృత్రిమంగా ఉంటుంది కానీ conversion ఎలా జరుగుతుందో overview ఇస్తుంది) +- JavaScript లో floating-point number యొక్క అసలు binary representation ఎలా చూడాలో example కోసం [floatAsBinaryString.js](floatAsBinaryString.js) చూడండి + +## References + +Floating-point numbers binary representation గురించి ఇంకా లోతుగా అర్థం చేసుకోవాలంటే ఇవి కూడా చూడొచ్చు: + +- [ఈ article interactive version](https://trekhleb.dev/blog/2021/binary-floating-point/) (bits ని మీరే set చేసి వచ్చే floating number చూడొచ్చు) +- [JavaScript Number type గురించి మీకు తెలియాల్సింది ఇదే](https://indepth.dev/posts/1139/here-is-what-you-need-to-know-about-javascripts-number-type) +- [Float Exposed](https://float.exposed/) +- [IEEE754 Visualization](https://bartaz.github.io/ieee754-visualization/) diff --git a/src/algorithms/math/bits/README.fr-FR.md b/src/algorithms/math/bits/README.fr-FR.md index 64ccd2dde1..4c4598b952 100644 --- a/src/algorithms/math/bits/README.fr-FR.md +++ b/src/algorithms/math/bits/README.fr-FR.md @@ -1,7 +1,8 @@ # Manipulation de bits _Read this in other languages:_ -[english](README.md). +[english](README.md), +[_తెలుగు_](README.tel-IN.md). #### Vérifier un bit (_get_) diff --git a/src/algorithms/math/bits/README.md b/src/algorithms/math/bits/README.md index 1218094287..f8e60871c9 100644 --- a/src/algorithms/math/bits/README.md +++ b/src/algorithms/math/bits/README.md @@ -2,7 +2,8 @@ _Read this in other languages:_ [français](README.fr-FR.md), -[简体中文](README.zh-CN.md). +[简体中文](README.zh-CN.md), +[_తెలుగు_](README.tel-IN.md). #### Get Bit diff --git a/src/algorithms/math/bits/README.tel-IN.md b/src/algorithms/math/bits/README.tel-IN.md new file mode 100644 index 0000000000..74242c47bc --- /dev/null +++ b/src/algorithms/math/bits/README.tel-IN.md @@ -0,0 +1,273 @@ +# Bit Manipulation + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Français_](README.fr-FR.md), +[_简体中文_](README.zh-CN.md) + +#### Get Bit + +ఈ method మనకి కావాల్సిన bit ని zeroth position కి జరుపుతుంది. +తర్వాత `0001` లాంటి bit pattern ఉన్న one తో `AND` operation చేస్తాం. +దాంతో original నంబర్ లో మనకి కావాల్సిన bit తప్ప మిగతా bits అన్నీ clear అయిపోతాయి. +ఆ bit one అయితే result `1`, లేకపోతే result `0`. + +> ఇంకా details కోసం [getBit.js](getBit.js) చూడండి. + +#### Set Bit + +ఈ method `1` ని `bitPosition` bits జరిపి, `00100` లాంటి ఒక value తయారుచేస్తుంది. +తర్వాత `OR` operation చేస్తాం — అది ఆ specific bit ని `1` గా set చేస్తుంది, కానీ +నంబర్ లో మిగతా bits మీద ఏ ఎఫెక్ట్ ఉండదు. + +> ఇంకా details కోసం [setBit.js](setBit.js) చూడండి. + +#### Clear Bit + +ఈ method `1` ని `bitPosition` bits జరిపి, `00100` లాంటి ఒక value తయారుచేస్తుంది. +తర్వాత ఈ mask ని తిరగేసి (invert చేసి) `11011` లాంటి నంబర్ తెచ్చుకుంటుంది. +తర్వాత నంబర్ కి, mask కి `AND` operation చేస్తాం. ఆ operation ఆ bit ని unset చేస్తుంది. + +> ఇంకా details కోసం [clearBit.js](clearBit.js) చూడండి. + +#### Update Bit + +ఈ method "Clear Bit", "Set Bit" methods రెండూ కలిపినది. + +> ఇంకా details కోసం [updateBit.js](updateBit.js) చూడండి. + +#### isEven + +ఇచ్చిన నంబర్ even ఆ కాదా అని ఈ method చెప్తుంది. +Odd numbers కి చివరి (కుడి వైపు) bit ఎప్పుడూ 1 గా set అయి ఉంటుంది అనే విషయం మీద ఇది పనిచేస్తుంది. + +```text +Number: 5 = 0b0101 +isEven: false + +Number: 4 = 0b0100 +isEven: true +``` + +> ఇంకా details కోసం [isEven.js](isEven.js) చూడండి. + +#### isPositive + +నంబర్ positive ఆ కాదా అని ఈ method చెప్తుంది. అన్ని positive నంబర్లకి ఎడమ వైపు చివరి bit +`0` గా set అయి ఉంటుంది అనే విషయం మీద ఇది పనిచేస్తుంది. కానీ ఇచ్చిన నంబర్ zero లేదా negative zero +అయితే, అప్పుడు కూడా `false` నే return చేయాలి. + +```text +Number: 1 = 0b0001 +isPositive: true + +Number: -1 = -0b0001 +isPositive: false +``` + +> ఇంకా details కోసం [isPositive.js](isPositive.js) చూడండి. + +#### Multiply By Two + +ఈ method original నంబర్ ని ఒక bit ఎడమకి జరుపుతుంది. +దాంతో binary నంబర్ లో ఉన్న అన్ని భాగాలు (రెండు యొక్క powers) రెండుతో గుణించబడతాయి, +కాబట్టి నంబర్ కూడా రెండుతో గుణించబడుతుంది. + +``` +Before the shift +Number: 0b0101 = 5 +Powers of two: 0 + 2^2 + 0 + 2^0 + +After the shift +Number: 0b1010 = 10 +Powers of two: 2^3 + 0 + 2^1 + 0 +``` + +> ఇంకా details కోసం [multiplyByTwo.js](multiplyByTwo.js) చూడండి. + +#### Divide By Two + +ఈ method original నంబర్ ని ఒక bit కుడికి జరుపుతుంది. +దాంతో binary నంబర్ లో ఉన్న అన్ని భాగాలు (రెండు యొక్క powers) రెండుతో భాగించబడతాయి, +కాబట్టి నంబర్ కూడా శేషం లేకుండా రెండుతో భాగించబడుతుంది. + +``` +Before the shift +Number: 0b0101 = 5 +Powers of two: 0 + 2^2 + 0 + 2^0 + +After the shift +Number: 0b0010 = 2 +Powers of two: 0 + 0 + 2^1 + 0 +``` + +> ఇంకా details కోసం [divideByTwo.js](divideByTwo.js) చూడండి. + +#### Switch Sign + +ఈ method positive నంబర్లని negative గా, negative నంబర్లని positive గా మారుస్తుంది. +దీనికి "Twos Complement" పద్ధతి వాడుతుంది — నంబర్ లో అన్ని bits ని తిరగేసి (invert చేసి) +దానికి 1 కలుపుతుంది. + +``` +1101 -3 +1110 -2 +1111 -1 +0000 0 +0001 1 +0010 2 +0011 3 +``` + +> ఇంకా details కోసం [switchSign.js](switchSign.js) చూడండి. + +#### రెండు Signed Numbers ని గుణించడం + +ఈ method bitwise operators వాడి రెండు signed integer నంబర్లని గుణిస్తుంది. +ఇది ఈ విషయాల మీద పనిచేస్తుంది: + +```text +a * b can be written in the below formats: + 0 if a is zero or b is zero or both a and b are zeroes + 2a * (b/2) if b is even + 2a * (b - 1)/2 + a if b is odd and positive + 2a * (b + 1)/2 - a if b is odd and negative +``` + +(అంటే: `a` గానీ `b` గానీ రెండూ గానీ zero అయితే `0`; `b` even అయితే `2a * (b/2)`; +`b` odd, positive అయితే `2a * (b - 1)/2 + a`; `b` odd, negative అయితే `2a * (b + 1)/2 - a`.) + +ఈ పద్ధతిలో advantage ఏంటంటే, ప్రతి recursive step లో operands లో ఒకటి దాని original value లో +సగానికి తగ్గుతుంది. కాబట్టి run time complexity `O(log(b))`, ఇక్కడ `b` అంటే ప్రతి recursive step లో +సగానికి తగ్గే operand. + +> ఇంకా details కోసం [multiply.js](multiply.js) చూడండి. + +#### రెండు Unsigned Numbers ని గుణించడం + +ఈ method bitwise operators వాడి రెండు integer నంబర్లని గుణిస్తుంది. +"ప్రతి నంబర్ ని 2 యొక్క powers మొత్తంగా రాయొచ్చు" అనే విషయం మీద ఇది పనిచేస్తుంది. + +Bitwise గుణకారం వెనక ముఖ్య ఐడియా ఏంటంటే, ప్రతి నంబర్ ని రెండు యొక్క powers మొత్తంగా +విడగొట్టొచ్చు: + +అంటే + +```text +19 = 2^4 + 2^1 + 2^0 +``` + +అప్పుడు నంబర్ `x` ని `19` తో గుణించడం అంటే ఇదే: + +```text +x * 19 = x * 2^4 + x * 2^1 + x * 2^0 +``` + +ఇప్పుడు గుర్తుపెట్టుకోవాల్సింది ఏంటంటే, `x * 2^4` అంటే `x` ని `4` bits ఎడమకి జరపడమే (`x << 4`). + +> ఇంకా details కోసం [multiplyUnsigned.js](multiplyUnsigned.js) చూడండి. + +#### Set Bits లెక్కపెట్టడం + +ఈ method bitwise operators వాడి నంబర్ లో ఎన్ని bits set అయి ఉన్నాయో లెక్కపెడుతుంది. +ముఖ్య ఐడియా ఏంటంటే, నంబర్ ని ఒక్కోసారి ఒక bit కుడికి జరుపుతూ, `&` operation result చెక్ చేస్తాం — +bit set అయి ఉంటే అది `1`, లేకపోతే `0`. + +```text +Number: 5 = 0b0101 +Count of set bits = 2 +``` + +> ఇంకా details కోసం [countSetBits.js](countSetBits.js) చూడండి. + +#### ఒక నంబర్ ని ఇంకో నంబర్ గా మార్చడానికి ఎన్ని Bits Flip చేయాలి + +ఒక నంబర్ ని ఇంకో నంబర్ గా మార్చడానికి ఎన్ని bits మార్చాలో ఈ method చెప్తుంది. +నంబర్లని `XOR` చేస్తే, result లో వేరువేరుగా ఉన్న bits మాత్రమే set అవుతాయి అనే property ని ఇది వాడుకుంటుంది. + +``` +5 = 0b0101 +1 = 0b0001 +Count of Bits to be Flipped: 1 +``` + +> ఇంకా details కోసం [bitsDiff.js](bitsDiff.js) చూడండి. + +#### ఒక నంబర్ లో ఎన్ని Bits ఉన్నాయి + +విలువైన bits ఎన్ని ఉన్నాయో లెక్కపెట్టడానికి, ప్రతిసారి `1` ని ఒక bit ఎడమకి జరుపుతూ, జరిపిన నంబర్ +input నంబర్ కంటే పెద్దదైందా అని చూడాలి. + +``` +5 = 0b0101 +Count of valuable bits is: 3 +When we shift 1 four times it will become bigger than 5. +``` + +(అంటే: `5` లో విలువైన bits 3. `1` ని నాలుగుసార్లు జరిపితే అది `5` కంటే పెద్దదవుతుంది.) + +> ఇంకా details కోసం [bitLength.js](bitLength.js) చూడండి. + +#### Is Power of Two + +ఇచ్చిన నంబర్ రెండు యొక్క power ఆ కాదా అని ఈ method చెక్ చేస్తుంది. ఇది ఈ property వాడుతుంది. +`powerNumber` అనేది రెండు యొక్క power గా వచ్చిన నంబర్ అనుకుందాం (అంటే 2, 4, 8, 16 లాంటివి). +అప్పుడు `powerNumber`, `powerNumber - 1` మధ్య `&` operation చేస్తే `0` వస్తుంది (నంబర్ రెండు +యొక్క power అయితే). + +``` +Number: 4 = 0b0100 +Number: 3 = (4 - 1) = 0b0011 +4 & 3 = 0b0100 & 0b0011 = 0b0000 <-- Equal to zero, is power of two. + +Number: 10 = 0b01010 +Number: 9 = (10 - 1) = 0b01001 +10 & 9 = 0b01010 & 0b01001 = 0b01000 <-- Not equal to zero, not a power of two. +``` + +(పైన: `4 & 3` zero కి సమానం, కాబట్టి రెండు యొక్క power. `10 & 9` zero కాదు, కాబట్టి రెండు యొక్క power కాదు.) + +> ఇంకా details కోసం [isPowerOfTwo.js](isPowerOfTwo.js) చూడండి. + +#### Full Adder + +ఈ method bitwise operators వాడి రెండు integer నంబర్లని కలుపుతుంది. + +Two's complement format లో ఉన్న రెండు 32-bit integers ని కలపడానికి ఇది [full adder]() +electronics circuit logic ని implement చేస్తుంది. రెండు input bits ని కలిపేటప్పుడు వచ్చే అన్ని possible +cases ని cover చేయడానికి boolean logic వాడుతుంది: ముందు ఉన్న less-significant stage నుంచి వచ్చే +"carry bit" ఉన్నప్పుడు, లేనప్పుడు. + +Legend (అర్థాలు): + +- `A`: నంబర్ `A` +- `B`: నంబర్ `B` +- `ai`: నంబర్ `A` యొక్క ith bit +- `bi`: నంబర్ `B` యొక్క ith bit +- `carryIn`: ముందు ఉన్న less-significant stage నుంచి వచ్చిన carry bit +- `carryOut`: తర్వాత ఉన్న most-significant stage కి పంపే carry bit +- `bitSum`: `ai`, `bi`, `carryIn` మొత్తం +- `resultBin`: ఇప్పటి stage ని, ముందు ఉన్న అన్ని less-significant stages తో కలిపితే వచ్చే పూర్తి result (binary లో) +- `resultDec`: ఇప్పటి stage ని, ముందు ఉన్న అన్ని less-significant stages తో కలిపితే వచ్చే పూర్తి result (decimal లో) + +``` +A = 3: 011 +B = 6: 110 +┌──────┬────┬────┬─────────┬──────────┬─────────┬───────────┬───────────┐ +│ bit │ ai │ bi │ carryIn │ carryOut │ bitSum │ resultBin │ resultDec │ +├──────┼────┼────┼─────────┼──────────┼─────────┼───────────┼───────────┤ +│ 0 │ 1 │ 0 │ 0 │ 0 │ 1 │ 1 │ 1 │ +│ 1 │ 1 │ 1 │ 0 │ 1 │ 0 │ 01 │ 1 │ +│ 2 │ 0 │ 1 │ 1 │ 1 │ 0 │ 001 │ 1 │ +│ 3 │ 0 │ 0 │ 1 │ 0 │ 1 │ 1001 │ 9 │ +└──────┴────┴────┴─────────┴──────────┴─────────┴───────────┴───────────┘ +``` + +> ఇంకా details కోసం [fullAdder.js](fullAdder.js) చూడండి. +> [YouTube లో Full Adder](https://www.youtube.com/watch?v=wvJc9CZcvBc&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) చూడండి. + +## References + +- [YouTube లో Bit Manipulation](https://www.youtube.com/watch?v=NLKQEOgBAnw&t=0s&index=28&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) +- [YouTube లో Binary లో Negative Numbers](https://www.youtube.com/watch?v=4qH4unVtJkE&t=0s&index=30&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) +- [stanford.edu లో Bit Hacks](https://graphics.stanford.edu/~seander/bithacks.html) diff --git a/src/algorithms/math/bits/README.zh-CN.md b/src/algorithms/math/bits/README.zh-CN.md index 9ec75069c6..139c0d54a8 100644 --- a/src/algorithms/math/bits/README.zh-CN.md +++ b/src/algorithms/math/bits/README.zh-CN.md @@ -2,7 +2,8 @@ _Read this in other languages:_ [français](README.fr-FR.md), -[english](README.md) +[english](README.md), +[_తెలుగు_](README.tel-IN.md) #### Get Bit diff --git a/src/algorithms/math/complex-number/README.fr-FR.md b/src/algorithms/math/complex-number/README.fr-FR.md index 0e42a484d4..31c5ae616d 100644 --- a/src/algorithms/math/complex-number/README.fr-FR.md +++ b/src/algorithms/math/complex-number/README.fr-FR.md @@ -1,7 +1,8 @@ # Nombre complexe _Read this in other languages:_ -[english](README.md). +[english](README.md), +[_తెలుగు_](README.tel-IN.md). Un **nombre complexe** est un nombre qui peut s'écrire sous la forme `a + b * i`, tels que `a` et `b` sont des nombres réels, diff --git a/src/algorithms/math/complex-number/README.md b/src/algorithms/math/complex-number/README.md index 7629aad3f0..fc686e2273 100644 --- a/src/algorithms/math/complex-number/README.md +++ b/src/algorithms/math/complex-number/README.md @@ -1,7 +1,8 @@ # Complex Number _Read this in other languages:_ -[français](README.fr-FR.md). +[français](README.fr-FR.md), +[_తెలుగు_](README.tel-IN.md). A **complex number** is a number that can be expressed in the form `a + b * i`, where `a` and `b` are real numbers, and `i` is a solution of diff --git a/src/algorithms/math/complex-number/README.tel-IN.md b/src/algorithms/math/complex-number/README.tel-IN.md new file mode 100644 index 0000000000..3fac88e246 --- /dev/null +++ b/src/algorithms/math/complex-number/README.tel-IN.md @@ -0,0 +1,220 @@ +# Complex Number + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Français_](README.fr-FR.md) + +**Complex number** అంటే `a + b * i` రూపంలో రాయగలిగే నంబర్ — ఇక్కడ `a`, `b` real numbers, +`i` అనేది `x^2 = −1` equation కి solution. ఏ _real number_ కూడా ఈ equation కి సరిపోదు కాబట్టి, +`i` ని _imaginary number_ అంటారు. Complex number `a + b * i` లో `a` ని _real part_ అని, +`b` ని _imaginary part_ అని అంటారు. + +![Complex Number](https://www.mathsisfun.com/numbers/images/complex-example.svg) + +Complex Number అంటే ఒక Real Number, ఒక Imaginary Number కలిస్తే వచ్చేది: + +![Complex Number](https://www.mathsisfun.com/numbers/images/complex-number.svg) + +Geometry పరంగా చూస్తే, complex numbers ఒక dimension ఉన్న number line ఐడియాని _రెండు dimensions +ఉన్న complex plane_ కి పెంచుతాయి — అడ్డం axis ని real part కి, నిలువు axis ని imaginary part కి +వాడతాయి. Complex number `a + b * i` ని complex plane లో `(a, b)` point గా చూడొచ్చు. + +Real part zero గా ఉన్న complex number ని _purely imaginary_ అంటారు; ఈ నంబర్ల points complex +plane లో నిలువు axis మీద ఉంటాయి. Imaginary part zero గా ఉన్న complex number ని _real number_ గా +చూడొచ్చు; దాని point complex plane లో అడ్డం axis మీద ఉంటుంది. + +| Complex Number | Real Part | Imaginary Part | | +| :------------- | :-------: | :------------: | ---------------- | +| 3 + 2i | 3 | 2 | | +| 5 | 5 | **0** | Purely Real | +| −6i | **0** | -6 | Purely Imaginary | + +Complex number ని _Argand diagram_ అనే diagram మీద vector ఏర్పరిచే `(a, b)` నంబర్ల జంటగా బొమ్మలో +చూపించొచ్చు — ఆ diagram _complex plane_ ని సూచిస్తుంది. `Re` అంటే real axis, `Im` అంటే imaginary +axis, ఇంకా `i` కి `i^2 = −1`. + +![Complex Number](https://upload.wikimedia.org/wikipedia/commons/a/af/Complex_number_illustration.svg) + +> Complex అంటే complicated (కష్టమైనది) అని కాదు. Real, imaginary అనే రెండు రకాల నంబర్లు కలిసి +> ఒక complex ని ఏర్పరుస్తాయి అని అర్థం — building complex (buildings అన్నీ కలిసి ఉండేది) లాగా. + +## Polar Form + +Complex plane లో ఒక point `P` ని x, y coordinates తో కాకుండా ఇంకో రకంగా కూడా చెప్పొచ్చు — +coordinates `(0, 0)` ఉన్న point `O` (origin) నుంచి ఆ point ఎంత దూరంలో ఉంది, ఇంకా positive real axis కి, +line segment `OP` కి మధ్య counterclockwise direction లో ఏర్పడే angle ఎంత — ఈ రెండిటితో. +ఈ ఐడియా నుంచే complex numbers polar form వచ్చింది. + +![Polar Form](https://upload.wikimedia.org/wikipedia/commons/7/7a/Complex_number_illustration_modarg.svg) + +Complex number `z = x + yi` యొక్క _absolute value_ (లేదా modulus లేదా magnitude): + +![Radius](https://wikimedia.org/api/rest_v1/media/math/render/svg/b59629c801aa0ddcdf17ee489e028fb9f8d4ea75) + +`z` యొక్క argument (చాలా applications లో దీన్ని "phase" అంటారు) అంటే radius `OP` కి positive +real axis కి మధ్య ఉన్న angle, దాన్ని `arg(z)` అని రాస్తారు. Modulus లాగానే, argument ని కూడా +rectangular form `x+yi` నుంచి కనుక్కోవచ్చు: + +![Phase](https://wikimedia.org/api/rest_v1/media/math/render/svg/7cbbdd9bb1dd5df86dd2b820b20f82995023e566) + +`r`, `φ` కలిపి complex numbers ని చూపించడానికి ఇంకో పద్ధతి ఇస్తాయి — అదే polar form. ఎందుకంటే +modulus, argument కలిస్తే plane మీద point position పూర్తిగా తెలిసిపోతుంది. Polar form నుంచి మళ్ళీ +original rectangular coordinates తెచ్చుకోవడానికి trigonometric form అనే formula వాడతారు: + +![Polar Form](https://wikimedia.org/api/rest_v1/media/math/render/svg/b03de1e1b7b049880b5e4870b68a57bc180ff6ce) + +Euler's formula వాడితే దీన్ని ఇలా రాయొచ్చు: + +![Euler's Form](https://wikimedia.org/api/rest_v1/media/math/render/svg/0a087c772212e7375cb321d83fc1fcc715cd0ed2) + +## Basic Operations + +### కూడిక (Adding) + +రెండు complex numbers కలపడానికి, ప్రతి part ని విడిగా కలుపుతాం: + +```text +(a + b * i) + (c + d * i) = (a + c) + (b + d) * i +``` + +**Example** + +```text +(3 + 5i) + (4 − 3i) = (3 + 4) + (5 − 3)i = 7 + 2i +``` + +Complex plane మీద కూడిక ఇలా కనిపిస్తుంది: + +![Complex Addition](https://www.mathsisfun.com/algebra/images/complex-plane-vector-add.svg) + +### తీసివేత (Subtracting) + +రెండు complex numbers తీసివేయడానికి, ప్రతి part ని విడిగా తీసివేస్తాం: + +```text +(a + b * i) - (c + d * i) = (a - c) + (b - d) * i +``` + +**Example** + +```text +(3 + 5i) - (4 − 3i) = (3 - 4) + (5 + 3)i = -1 + 8i +``` + +### గుణకారం (Multiplying) + +Complex numbers ని గుణించడానికి, మొదటి complex number లో ప్రతి part ని రెండో complex number లో +ప్రతి part తో గుణిస్తాం: + +"FOIL" వాడండి చాలు — అంటే "**F**irsts, **O**uters, **I**nners, **L**asts" (ఇంకా details కోసం +[Binomial Multiplication](https://www.mathsisfun.com/algebra/polynomials-multiplying.html) చూడండి): + +![Complex Multiplication](https://www.mathsisfun.com/algebra/images/foil-complex.svg) + +- Firsts: `a × c` +- Outers: `a × di` +- Inners: `bi × c` +- Lasts: `bi × di` + +జనరల్ గా ఇలా ఉంటుంది: + +```text +(a + bi)(c + di) = ac + adi + bci + bdi^2 +``` + +కానీ ఇంకా ఫాస్ట్ పద్ధతి కూడా ఉంది! + +ఈ rule వాడండి: + +```text +(a + bi)(c + di) = (ac − bd) + (ad + bc)i +``` + +**Example** + +```text +(3 + 2i)(1 + 7i) += 3×1 + 3×7i + 2i×1+ 2i×7i += 3 + 21i + 2i + 14i^2 += 3 + 21i + 2i − 14 (because i^2 = −1) += −11 + 23i +``` + +```text +(3 + 2i)(1 + 7i) = (3×1 − 2×7) + (3×7 + 2×1)i = −11 + 23i +``` + +### Conjugates + +ఇంకో నిమిషంలో conjugates గురించి తెలియాల్సి వస్తుంది! + +Conjugate అంటే మధ్యలో ఉన్న sign ని ఇలా మార్చడం: + +![Complex Conjugate](https://www.mathsisfun.com/numbers/images/complex-conjugate.svg) + +Conjugate ని మామూలుగా దాని పైన ఒక గీత (bar) పెట్టి రాస్తారు: + +```text +______ +5 − 3i = 5 + 3i +``` + +Complex plane మీద conjugate నంబర్ real axis దగ్గర అద్దంలో చూసినట్టు (mirror) కనిపిస్తుంది. + +![Complex Conjugate](https://upload.wikimedia.org/wikipedia/commons/6/69/Complex_conjugate_picture.svg) + +### భాగహారం (Dividing) + +Complex భాగహారం లో conjugate ఉపయోగపడుతుంది. + +Trick ఏంటంటే — _పైన, కింద రెండిటినీ కింద ఉన్నదాని conjugate తో గుణించడం_. + +**Example** + +```text +2 + 3i +------ +4 − 5i +``` + +పైన, కింద రెండిటినీ `4 − 5i` యొక్క conjugate తో గుణించండి: + +```text + (2 + 3i) * (4 + 5i) 8 + 10i + 12i + 15i^2 += ------------------- = ---------------------- + (4 − 5i) * (4 + 5i) 16 + 20i − 20i − 25i^2 +``` + +ఇప్పుడు `i^2 = −1` అని గుర్తుపెట్టుకోండి, కాబట్టి: + +```text + 8 + 10i + 12i − 15 −7 + 22i −7 22 += ------------------- = -------- = -- + -- * i + 16 + 20i − 20i + 25 41 41 41 + +``` + +కానీ ఇంకా ఫాస్ట్ పద్ధతి కూడా ఉంది. + +పైన example లో, కింద (denominator లో) జరిగింది interesting గా ఉంది: + +```text +(4 − 5i)(4 + 5i) = 16 + 20i − 20i − 25i +``` + +మధ్యలో ఉన్న terms `(20i − 20i)` ఒకదాన్నొకటి cancel చేసుకుంటాయి! ఇంకా `i^2 = −1` కాబట్టి ఇది వస్తుంది: + +```text +(4 − 5i)(4 + 5i) = 4^2 + 5^2 +``` + +ఇది నిజంగా చాలా సింపుల్ result. జనరల్ rule ఇది: + +```text +(a + bi)(a − bi) = a^2 + b^2 +``` + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Complex_number) +- [Math is Fun](https://www.mathsisfun.com/numbers/complex-numbers.html) diff --git a/src/algorithms/math/euclidean-algorithm/README.fr-FR.md b/src/algorithms/math/euclidean-algorithm/README.fr-FR.md index 75b6a90b88..6e39ead358 100644 --- a/src/algorithms/math/euclidean-algorithm/README.fr-FR.md +++ b/src/algorithms/math/euclidean-algorithm/README.fr-FR.md @@ -1,7 +1,8 @@ # Algorithme d'Euclide _Read this in other languages:_ -[english](README.md). +[english](README.md), +[_తెలుగు_](README.tel-IN.md). En mathématiques, l'algorithme d'Euclide est un algorithme qui calcule le plus grand commun diviseur (PGCD) de deux entiers, c'est-à-dire le plus grand entier qui divise les deux entiers, en laissant un reste nul. L'algorithme ne connaît pas la factorisation de ces deux nombres. diff --git a/src/algorithms/math/euclidean-algorithm/README.md b/src/algorithms/math/euclidean-algorithm/README.md index 89af03b15e..d521f20b84 100644 --- a/src/algorithms/math/euclidean-algorithm/README.md +++ b/src/algorithms/math/euclidean-algorithm/README.md @@ -1,7 +1,8 @@ # Euclidean algorithm _Read this in other languages:_ -[français](README.fr-FR.md). +[français](README.fr-FR.md), +[_తెలుగు_](README.tel-IN.md). In mathematics, the Euclidean algorithm, or Euclid's algorithm, is an efficient method for computing the greatest common divisor diff --git a/src/algorithms/math/euclidean-algorithm/README.tel-IN.md b/src/algorithms/math/euclidean-algorithm/README.tel-IN.md new file mode 100644 index 0000000000..d44205accb --- /dev/null +++ b/src/algorithms/math/euclidean-algorithm/README.tel-IN.md @@ -0,0 +1,47 @@ +# Euclidean algorithm + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Français_](README.fr-FR.md) + +Mathematics లో Euclidean algorithm (లేదా Euclid's algorithm) అనేది రెండు నంబర్ల +greatest common divisor (GCD) ఫాస్ట్ గా కనుక్కునే పద్ధతి. GCD అంటే ఆ రెండు నంబర్లనీ +శేషం (remainder) లేకుండా భాగించే అతి పెద్ద నంబర్. + +Euclidean algorithm ఒక సూత్రం మీద పనిచేస్తుంది — రెండు నంబర్లలో పెద్ద నంబర్ బదులు, +దానికి చిన్న నంబర్ కి ఉన్న తేడా పెట్టినా GCD మారదు. ఉదాహరణకి, `252`, `105` కి GCD `21` +(ఎందుకంటే `252 = 21 × 12`, `105 = 21 × 5`), ఇంకా అదే `21` నంబర్ `105`, `252 − 105 = 147` కి +కూడా GCD. ఇలా మార్చిన ప్రతిసారి పెద్ద నంబర్ తగ్గుతుంది కాబట్టి, ఇదే మళ్ళీ మళ్ళీ చేస్తే +నంబర్ల జంటలు చిన్నవవుతూ వస్తాయి, చివరికి రెండు నంబర్లు సమానం అవుతాయి. +అప్పుడు ఆ నంబరే మొదటి రెండు నంబర్ల GCD. + +Steps ని వెనక్కి తిప్పితే, GCD ని మొదటి రెండు నంబర్లని ఒక్కోదాన్ని positive లేదా negative +integer తో గుణించి కలిపిన మొత్తంగా రాయొచ్చు, ఉదాహరణకి `21 = 5 × 105 + (−2) × 252`. +GCD ని ఎప్పుడూ ఇలా రాయొచ్చు అనే విషయాన్ని Bézout's identity అంటారు. + +![GCD](https://upload.wikimedia.org/wikipedia/commons/3/37/Euclid%27s_algorithm_Book_VII_Proposition_2_3.png) + +`BA`, `DC` అనే రెండు పొడవులకి greatest common divisor (GCD) కనుక్కునే Euclid పద్ధతి — ఈ +రెండూ ఒక common "unit" పొడవుకి multiples. `DC` చిన్నది కాబట్టి దాంతో `BA` ని "కొలుస్తాం", +కానీ ఒక్కసారే — ఎందుకంటే మిగిలిన `EA`, `DC` కంటే చిన్నది. ఇప్పుడు EA తో చిన్న పొడవు `DC` ని +(రెండుసార్లు) కొలుస్తాం, మిగిలిన `FC`, `EA` కంటే చిన్నది. తర్వాత `FC` తో `EA` ని (మూడుసార్లు) +కొలుస్తాం. ఏమీ మిగలలేదు కాబట్టి, ఇక్కడితో అయిపోయింది — `FC` నే `GCD`. +కుడి వైపు Nicomachus example ఉంది — `49`, `21` నంబర్లకి GCD `7` వచ్చింది (Heath 1908:300 నుంచి). + +![GCD](https://upload.wikimedia.org/wikipedia/commons/7/74/24x60.svg) + +`24-by-60` rectangle ని పది `12-by-12` square tiles తో కప్పేశారు, ఇక్కడ `12` అనేది `24`, `60` +కి GCD. జనరల్ గా చెప్పాలంటే, `a-by-b` rectangle ని `c` పొడవు ఉన్న square tiles తో కప్పాలంటే, +`c` అనేది `a`, `b` రెండిటికీ common divisor అయి ఉండాలి. + +![GCD](https://upload.wikimedia.org/wikipedia/commons/1/1c/Euclidean_algorithm_1071_462.gif) + +తీసివేత (subtraction) మీద బేస్ అయిన Euclidean algorithm animation. +మొదటి rectangle సైజ్ `a = 1071`, `b = 462`. అందులో `462×462` సైజ్ squares పెడితే +`462×147` rectangle మిగులుతుంది. ఈ rectangle ని `147×147` squares తో నింపితే `21×147` +rectangle మిగులుతుంది, దాన్ని `21×21` squares తో నింపితే ఏమీ ఖాళీ మిగలదు. +అతి చిన్న square సైజ్ `21` నే `1071`, `462` కి GCD. + +## References + +[Wikipedia](https://en.wikipedia.org/wiki/Euclidean_algorithm) diff --git a/src/algorithms/math/euclidean-distance/README.md b/src/algorithms/math/euclidean-distance/README.md index d67c217efe..7e75d750ec 100644 --- a/src/algorithms/math/euclidean-distance/README.md +++ b/src/algorithms/math/euclidean-distance/README.md @@ -1,5 +1,8 @@ # Euclidean Distance +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + In mathematics, the **Euclidean distance** between two points in Euclidean space is the length of a line segment between the two points. It can be calculated from the Cartesian coordinates of the points using the Pythagorean theorem, therefore occasionally being called the Pythagorean distance. ![Euclidean distance between two points](https://upload.wikimedia.org/wikipedia/commons/5/55/Euclidean_distance_2d.svg) diff --git a/src/algorithms/math/euclidean-distance/README.tel-IN.md b/src/algorithms/math/euclidean-distance/README.tel-IN.md new file mode 100644 index 0000000000..767a63cd67 --- /dev/null +++ b/src/algorithms/math/euclidean-distance/README.tel-IN.md @@ -0,0 +1,39 @@ +# Euclidean Distance + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Mathematics లో, Euclidean space లో రెండు points మధ్య **Euclidean distance** అంటే ఆ రెండు points ని కలిపే line segment పొడవు. Points యొక్క Cartesian coordinates నుంచి Pythagorean theorem వాడి దీన్ని లెక్కపెట్టొచ్చు, అందుకే దీన్ని కొన్నిసార్లు Pythagorean distance అని కూడా అంటారు. + +![Euclidean distance between two points](https://upload.wikimedia.org/wikipedia/commons/5/55/Euclidean_distance_2d.svg) + +## Distance formulas + +### One dimension + +Real line మీద ఏవైనా రెండు points మధ్య దూరం అంటే, వాటి coordinates తేడా యొక్క absolute value + +![One dimension formula](https://wikimedia.org/api/rest_v1/media/math/render/svg/7d75418dbec9482dbcb70f9063ad66e9cf7b5db9) + +### Two dimensions + +![Two dimensions formula](https://wikimedia.org/api/rest_v1/media/math/render/svg/9c0157084fd89f5f3d462efeedc47d3d7aa0b773) + +### Higher dimensions + +Three dimensions లో, Cartesian coordinates ఇచ్చిన points కి distance ఇది + +![Three dimensions formula](https://wikimedia.org/api/rest_v1/media/math/render/svg/d1d13a40a7b203b455ae6d4be8b3cce898bda625) + +Example: `(8,2,6)`, `(3,5,7)` అనే రెండు points మధ్య దూరం: + +![3-dimension example](https://www.mathsisfun.com/algebra/images/dist-2-points-3d.svg) + +జనరల్ గా, `n`-dimensional Euclidean space లో Cartesian coordinates ఇచ్చిన points కి distance ఇది + +![n-dimensional formula](https://wikimedia.org/api/rest_v1/media/math/render/svg/a0ef4fe055b2a51b4cca43a05e5d1cd93f758dcc) + +## References + +- [MathIsFun లో Euclidean Distance](https://www.mathsisfun.com/algebra/distance-2-points.html) +- [Wikipedia లో Euclidean Distance](https://en.wikipedia.org/wiki/Euclidean_distance) diff --git a/src/algorithms/math/factorial/README.fr-FR.md b/src/algorithms/math/factorial/README.fr-FR.md index aa092c1b78..d5573b7ff7 100644 --- a/src/algorithms/math/factorial/README.fr-FR.md +++ b/src/algorithms/math/factorial/README.fr-FR.md @@ -1,7 +1,8 @@ # Factorielle _Lisez ceci dans d'autres langues:_ -[english](README.md), [_简体中文_](README.zh-CN.md). +[english](README.md), [_简体中文_](README.zh-CN.md), +[_తెలుగు_](README.tel-IN.md). En mathématiques, la factorielle d'un entier naturel `n`, notée avec un point d'exclamation `n!`, est le produit des nombres entiers diff --git a/src/algorithms/math/factorial/README.md b/src/algorithms/math/factorial/README.md index 9c75b41aae..867a9b53dc 100644 --- a/src/algorithms/math/factorial/README.md +++ b/src/algorithms/math/factorial/README.md @@ -1,7 +1,8 @@ # Factorial _Read this in other languages:_ -[_简体中文_](README.zh-CN.md), [_Français_](README.fr-FR.md), [_Türkçe_](README.tr-TR.md), [_ქართული_](README.ka-GE.md), [_Українська_](README.uk-UA.md). +[_简体中文_](README.zh-CN.md), [_Français_](README.fr-FR.md), [_Türkçe_](README.tr-TR.md), [_ქართული_](README.ka-GE.md), [_Українська_](README.uk-UA.md), +[_తెలుగు_](README.tel-IN.md). In mathematics, the factorial of a non-negative integer `n`, denoted by `n!`, is the product of all positive integers less diff --git a/src/algorithms/math/factorial/README.tel-IN.md b/src/algorithms/math/factorial/README.tel-IN.md new file mode 100644 index 0000000000..a35d89cd02 --- /dev/null +++ b/src/algorithms/math/factorial/README.tel-IN.md @@ -0,0 +1,34 @@ +# Factorial + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), [_简体中文_](README.zh-CN.md), [_Français_](README.fr-FR.md), [_Türkçe_](README.tr-TR.md), [_ქართული_](README.ka-GE.md), [_Українська_](README.uk-UA.md). + +Mathematics లో, negative కాని integer `n` యొక్క factorial ని `n!` అని రాస్తారు. అంటే `n` కంటే +తక్కువ లేదా సమానంగా ఉన్న అన్ని positive integers ని గుణిస్తే వచ్చేది. ఉదాహరణకి: + +``` +5! = 5 * 4 * 3 * 2 * 1 = 120 +``` + +| n | n! | +| --- | ----------------: | +| 0 | 1 | +| 1 | 1 | +| 2 | 2 | +| 3 | 6 | +| 4 | 24 | +| 5 | 120 | +| 6 | 720 | +| 7 | 5 040 | +| 8 | 40 320 | +| 9 | 362 880 | +| 10 | 3 628 800 | +| 11 | 39 916 800 | +| 12 | 479 001 600 | +| 13 | 6 227 020 800 | +| 14 | 87 178 291 200 | +| 15 | 1 307 674 368 000 | + +## References + +[Wikipedia](https://en.wikipedia.org/wiki/Factorial) diff --git a/src/algorithms/math/factorial/README.tr-TR.md b/src/algorithms/math/factorial/README.tr-TR.md index 68ce21a299..4e05a8388a 100644 --- a/src/algorithms/math/factorial/README.tr-TR.md +++ b/src/algorithms/math/factorial/README.tr-TR.md @@ -1,7 +1,8 @@ # Faktöriyel _Bunu diğer dillerde okuyun:_ -[_简体中文_](README.zh-CN.md), [français](README.fr-FR.md). +[_简体中文_](README.zh-CN.md), [français](README.fr-FR.md), +[_తెలుగు_](README.tel-IN.md). Faktöriyel, matematikte, sağına ünlem işareti konulmuş sayıya verilen isim, daha genel olan Gama fonksiyonunun tam sayılarla diff --git a/src/algorithms/math/factorial/README.uk-UA.md b/src/algorithms/math/factorial/README.uk-UA.md index bf75963113..9706e95b79 100644 --- a/src/algorithms/math/factorial/README.uk-UA.md +++ b/src/algorithms/math/factorial/README.uk-UA.md @@ -1,7 +1,8 @@ # Факторіал _Прочитайте це іншими мовами:_ -[_English_](README.md), [_简体中文_](README.zh-CN.md), [_Français_](README.fr-FR.md), [_Türkçe_](README.tr-TR.md), [_ქართული_](README.ka-GE.md). +[_English_](README.md), [_简体中文_](README.zh-CN.md), [_Français_](README.fr-FR.md), [_Türkçe_](README.tr-TR.md), [_ქართული_](README.ka-GE.md), +[_తెలుగు_](README.tel-IN.md). У математиці факторіал невід'ємного цілого числа `n`, позначений `n!`, є добутком усіх натуральних чисел, менших або рівних `n`. Наприклад: diff --git a/src/algorithms/math/fast-powering/README.fr-FR.md b/src/algorithms/math/fast-powering/README.fr-FR.md index ba44244cc8..0efae4c22a 100644 --- a/src/algorithms/math/fast-powering/README.fr-FR.md +++ b/src/algorithms/math/fast-powering/README.fr-FR.md @@ -1,7 +1,8 @@ # Algorithme d'exponentiation rapide _Read this in other languages:_ -[english](README.md). +[english](README.md), +[_తెలుగు_](README.tel-IN.md). En algèbre, une **puissance** d'un nombre est le résultat de la multiplication répétée de ce nombre avec lui-même. diff --git a/src/algorithms/math/fast-powering/README.md b/src/algorithms/math/fast-powering/README.md index 2c2619d2ef..819002ba9d 100644 --- a/src/algorithms/math/fast-powering/README.md +++ b/src/algorithms/math/fast-powering/README.md @@ -1,7 +1,8 @@ # Fast Powering Algorithm _Read this in other languages:_ -[français](README.fr-FR.md). +[français](README.fr-FR.md), +[_తెలుగు_](README.tel-IN.md). **The power of a number** says how many times to use the number in a multiplication. diff --git a/src/algorithms/math/fast-powering/README.tel-IN.md b/src/algorithms/math/fast-powering/README.tel-IN.md new file mode 100644 index 0000000000..0ab74fdb29 --- /dev/null +++ b/src/algorithms/math/fast-powering/README.tel-IN.md @@ -0,0 +1,72 @@ +# Fast Powering Algorithm + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Français_](README.fr-FR.md) + +**ఒక నంబర్ యొక్క power** అంటే ఆ నంబర్ ని గుణకారంలో ఎన్నిసార్లు వాడాలో చెప్తుంది. + +దీన్ని base నంబర్ కి కుడి వైపు పైన ఒక చిన్న నంబర్ గా రాస్తారు. + +![Power](https://www.mathsisfun.com/algebra/images/exponent-8-2.svg) + +## Naive Algorithm Complexity + +`a` కి power `b` ఎలా కనుక్కోవాలి? + +`a` ని దానితోనే `b` సార్లు గుణిస్తాం. అంటే, +`a^b = a * a * a * ... * a` (`a` మొత్తం `b` సార్లు). + +గుణకారం సరిగ్గా `n` సార్లు చేయాలి కాబట్టి దీనికి `O(n)` టైమ్ పడుతుంది. + +## Fast Power Algorithm + +Naive algorithm కంటే బెటర్ గా చేయగలమా? చేయగలం — power లెక్కని `O(log(n))` టైమ్ లో +solve చేయొచ్చు. + +ఈ algorithm power లెక్కపెట్టడానికి divide and conquer approach వాడుతుంది. ప్రస్తుతానికి +ఈ algorithm `X`, `Y` అనే రెండు positive integers కి మాత్రమే పనిచేస్తుంది. + +ఈ algorithm వెనక ఉన్న ఐడియా ఈ విషయం మీద బేస్ అయింది: + +`Y` **even** అయితే: + +```text +X^Y = X^(Y/2) * X^(Y/2) +``` + +`Y` **odd** అయితే: + +```text +X^Y = X^(Y//2) * X^(Y//2) * X +where Y//2 is result of division of Y by 2 without reminder. +``` + +(ఇక్కడ `Y//2` అంటే `Y` ని 2 తో భాగిస్తే శేషం లేకుండా వచ్చే భాగఫలం.) + +**ఉదాహరణకి** + +```text +2^4 = (2 * 2) * (2 * 2) = (2^2) * (2^2) +``` + +```text +2^5 = (2 * 2) * (2 * 2) * 2 = (2^2) * (2^2) * (2) +``` + +ఇప్పుడు, ప్రతి step లో అదే `X^(Y/2)` power ని రెండుసార్లు లెక్కపెట్టాలి కాబట్టి, దాన్ని ఒక +మధ్యంతర variable లో save చేసుకుంటే మళ్ళీ లెక్కపెట్టాల్సిన పని ఉండదు — అలా optimize చేయొచ్చు. + +**Time Complexity** + +ప్రతి iteration లో power ని సగం చేస్తాం కాబట్టి, function ని recursive గా `log(n)` సార్లు +call చేస్తాం. కాబట్టి algorithm time complexity ఇంతకి తగ్గుతుంది: + +```text +O(log(n)) +``` + +## References + +- [YouTube](https://www.youtube.com/watch?v=LUWavfN9zEo&index=80&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&t=0s) +- [Wikipedia](https://en.wikipedia.org/wiki/Exponentiation_by_squaring) diff --git a/src/algorithms/math/fibonacci/README.fr-FR.md b/src/algorithms/math/fibonacci/README.fr-FR.md index 81e3549b0d..dd0d14e513 100644 --- a/src/algorithms/math/fibonacci/README.fr-FR.md +++ b/src/algorithms/math/fibonacci/README.fr-FR.md @@ -2,7 +2,8 @@ _Read this in other languages:_ [english](README.md), -[ქართული](README.ka-GE.md). +[ქართული](README.ka-GE.md), +[_తెలుగు_](README.tel-IN.md). En mathématiques, la suite de Fibonacci est une suite d'entiers dans laquelle chaque terme (après les deux premiers) diff --git a/src/algorithms/math/fibonacci/README.md b/src/algorithms/math/fibonacci/README.md index 3d476c5020..df1089e1bf 100644 --- a/src/algorithms/math/fibonacci/README.md +++ b/src/algorithms/math/fibonacci/README.md @@ -3,7 +3,8 @@ _Read this in other languages:_ [français](README.fr-FR.md), [简体中文](README.zh-CN.md), -[ქართული](README.ka-GE.md). +[ქართული](README.ka-GE.md), +[_తెలుగు_](README.tel-IN.md). In mathematics, the Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and characterized by diff --git a/src/algorithms/math/fibonacci/README.tel-IN.md b/src/algorithms/math/fibonacci/README.tel-IN.md new file mode 100644 index 0000000000..dc566cf074 --- /dev/null +++ b/src/algorithms/math/fibonacci/README.tel-IN.md @@ -0,0 +1,25 @@ +# Fibonacci Number + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Français_](README.fr-FR.md), +[_简体中文_](README.zh-CN.md), +[_ქართული_](README.ka-GE.md) + +Mathematics లో Fibonacci numbers అంటే కింద ఉన్న integer sequence లో ఉండే నంబర్లు — +దీన్ని Fibonacci sequence అంటారు. ఇందులో మొదటి రెండు నంబర్ల తర్వాత వచ్చే ప్రతి నంబర్, +దాని ముందు ఉన్న రెండు నంబర్ల మొత్తం: + +`0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...` + +వరుస Fibonacci numbers సైజ్ ఉన్న squares తో వేసిన tiling + +![Fibonacci](https://upload.wikimedia.org/wikipedia/commons/d/db/34%2A21-FibonacciBlocks.png) + +Fibonacci spiral: Fibonacci tiling లో squares ఎదురెదురు మూలలని కలుపుతూ వంపు గీతలు (circular arcs) గీస్తే వచ్చే golden spiral కి దగ్గరగా ఉండే spiral; ఇందులో 1, 1, 2, 3, 5, 8, 13, 21 సైజ్ squares వాడారు. + +![Fibonacci Spiral](https://upload.wikimedia.org/wikipedia/commons/2/2e/FibonacciSpiral.svg) + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Fibonacci_number) diff --git a/src/algorithms/math/fibonacci/README.zh-CN.md b/src/algorithms/math/fibonacci/README.zh-CN.md index 20378000d4..724c0cd925 100644 --- a/src/algorithms/math/fibonacci/README.zh-CN.md +++ b/src/algorithms/math/fibonacci/README.zh-CN.md @@ -3,7 +3,8 @@ _Read this in other languages:_ [français](README.fr-FR.md), [english](README.md), -[ქართული](README.ka-GE.md). +[ქართული](README.ka-GE.md), +[_తెలుగు_](README.tel-IN.md). 在数学中,斐波那契数是以下整数序列(称为斐波那契数列)中的数字,其特征在于前两个数字之后的每个数字都是前两个数字的和: diff --git a/src/algorithms/math/fourier-transform/README.fr-FR.md b/src/algorithms/math/fourier-transform/README.fr-FR.md index 0d345164c7..36df4279f4 100644 --- a/src/algorithms/math/fourier-transform/README.fr-FR.md +++ b/src/algorithms/math/fourier-transform/README.fr-FR.md @@ -1,7 +1,8 @@ # Transformation de Fourier _Read this in other languages:_ -[english](README.md). +[english](README.md), +[_తెలుగు_](README.tel-IN.md). ## Définitions diff --git a/src/algorithms/math/fourier-transform/README.md b/src/algorithms/math/fourier-transform/README.md index f7969ddd5c..fd7fbbf742 100644 --- a/src/algorithms/math/fourier-transform/README.md +++ b/src/algorithms/math/fourier-transform/README.md @@ -1,7 +1,8 @@ # Fourier Transform _Read this in other languages:_ -[français](README.fr-FR.md). +[français](README.fr-FR.md), +[_తెలుగు_](README.tel-IN.md). ## Definitions diff --git a/src/algorithms/math/fourier-transform/README.tel-IN.md b/src/algorithms/math/fourier-transform/README.tel-IN.md new file mode 100644 index 0000000000..1207796551 --- /dev/null +++ b/src/algorithms/math/fourier-transform/README.tel-IN.md @@ -0,0 +1,127 @@ +# Fourier Transform + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Français_](README.fr-FR.md) + +## Definitions + +**Fourier Transform** (**FT**) అనేది టైమ్ మీద ఆధారపడే ఒక function (signal) ని, దాన్ని తయారుచేసే +frequencies గా విడగొడుతుంది — ఒక musical chord ని, దాంట్లో ఉన్న notes యొక్క frequencies (లేదా +pitches) గా చెప్పినట్టు. + +**Discrete Fourier Transform** (**DFT**) అనేది ఒక function నుంచి సమాన దూరాల్లో తీసుకున్న finite +samples sequence ని, discrete-time Fourier transform (DTFT) నుంచి సమాన దూరాల్లో తీసుకున్న అంతే +పొడవు ఉన్న samples sequence గా మారుస్తుంది — DTFT అనేది frequency మీద ఆధారపడే complex-valued +function. DTFT ని ఏ interval లో sample చేస్తారో, అది input sequence duration కి reciprocal. Inverse DFT +అనేది ఒక Fourier series — DTFT samples ని, వాటికి సరిపోయే DTFT frequencies దగ్గర complex sinusoids కి +coefficients గా వాడుతుంది. దీనికి original input sequence కి ఉన్న sample-values నే ఉంటాయి. అందుకే DFT ని +original input sequence యొక్క frequency domain representation అంటారు. Original sequence ఒక function +యొక్క అన్ని non-zero values ని cover చేస్తే, దాని DTFT continuous (ఇంకా periodic) గా ఉంటుంది, DFT ఒక +cycle యొక్క discrete samples ఇస్తుంది. Original sequence ఒక periodic function యొక్క ఒక cycle అయితే, +DFT ఒక DTFT cycle యొక్క అన్ని non-zero values ఇస్తుంది. + +Discrete Fourier transform `N` complex numbers ఉన్న ఈ sequence ని: + +{xn} = x0, x1, x2 ..., xN-1 + +ఇంకో complex numbers sequence గా మారుస్తుంది: + +{Xk} = X0, X1, X2 ..., XN-1 + +దాన్ని ఇలా define చేస్తారు: + +![DFT](https://wikimedia.org/api/rest_v1/media/math/render/svg/1af0a78dc50bbf118ab6bd4c4dcc3c4ff8502223) + +**Discrete-Time Fourier Transform** (**DTFT**) అనేది ఒక continuous function నుంచి సమాన దూరాల్లో +తీసుకున్న samples కి వర్తించే ఒక రకమైన Fourier analysis. Discrete-time అంటే ఈ transform discrete data +(samples) మీద పనిచేస్తుంది అని — ఆ samples interval కి మామూలుగా టైమ్ units ఉంటాయి. కేవలం samples +నుంచే ఇది ఒక frequency function తయారుచేస్తుంది — అది original continuous function యొక్క continuous +Fourier transform ని periodic గా కలిపితే వచ్చేది. + +**Fast Fourier Transform** (**FFT**) అనేది ఒక signal ని కొంత టైమ్ (లేదా space) పాటు sample చేసి, +దాన్ని frequency components గా విడగొట్టే algorithm. ఈ components అనేవి వేరువేరు frequencies దగ్గర +ఉండే ఒక్కో sinusoidal oscillation — ప్రతిదానికి దాని సొంత amplitude, phase ఉంటాయి. + +ఈ మార్పుని కింద Diagram లో చూపించారు. Diagram లో కొలిచిన టైమ్ లో, signal లో 3 వేరువేరు ముఖ్యమైన +frequencies ఉన్నాయి. + +ఒక signal ని time domain లో, frequency domain లో చూస్తే: + +![FFT](https://upload.wikimedia.org/wikipedia/commons/6/61/FFT-Time-Frequency-View.png) + +FFT algorithm ఒక sequence యొక్క discrete Fourier transform (DFT) ని గానీ, దాని inverse (IFFT) ని గానీ +లెక్కపెడుతుంది. Fourier analysis ఒక signal ని దాని original domain నుంచి frequency domain కి, +frequency domain నుంచి మళ్ళీ original domain కి మారుస్తుంది. DFT matrix ని sparse (ఎక్కువగా zeroes ఉండే) +factors గుణకారంగా విడగొట్టి, FFT ఈ మార్పులని ఫాస్ట్ గా లెక్కపెడుతుంది. దాంతో DFT లెక్కపెట్టే complexity ని +O(n2) నుంచి (DFT definition ని డైరెక్ట్ గా వాడితే ఇదే వస్తుంది) O(n log n) కి తగ్గిస్తుంది — +ఇక్కడ n అంటే data సైజ్. + +10, 20, 30, 40, 50 Hz దగ్గర ఉన్న cosine waves మొత్తానికి discrete Fourier analysis ఇక్కడ ఉంది: + +![FFT](https://upload.wikimedia.org/wikipedia/commons/6/64/FFT_of_Cosine_Summation_Function.png) + +## Explanation (సింపుల్ గా అర్థం) + +Fourier Transform అనేది ఇప్పటివరకు వచ్చిన అతి లోతైన ఆలోచనల్లో ఒకటి. దురదృష్టం ఏంటంటే, దాని అర్థం +కష్టమైన equations లో దాగి ఉంటుంది: + +![](https://betterexplained.com/wp-content/plugins/wp-latexrender/pictures/45c088dbb767150fc0bacfeb49dd49e5.png) + +ఇంకా + +![](https://betterexplained.com/wp-content/plugins/wp-latexrender/pictures/faeb9c5bf2e60add63ae4a70b293c7b4.png) + +Symbols లోకి దూకే ముందు, ముఖ్య ఐడియాని మనమే అనుభవించి చూద్దాం. సింపుల్ ఉదాహరణ ఇది: + +- _Fourier Transform ఏం చేస్తుంది?_ ఒక smoothie (జ్యూస్) ఇస్తే, దాని recipe కనుక్కుంటుంది. +- _ఎలా?_ Smoothie ని filters గుండా పంపి, ఒక్కో ingredient ని బయటికి తీస్తుంది. +- _ఎందుకు?_ Smoothie కంటే recipe ని analyze చేయడం, compare చేయడం, మార్చడం ఈజీ. +- _Smoothie మళ్ళీ ఎలా తెచ్చుకోవాలి?_ Ingredients ని మళ్ళీ mixie లో వేయండి. + +**Sinusoids గా మాత్రమే కాదు, Circles గా ఆలోచించండి** + +Fourier Transform అనేది వృత్తాకార దారుల (1-d sinusoids కాదు) గురించి, ఇంకా Euler's formula అలాంటి +దారిని తయారుచేసే ఒక తెలివైన పద్ధతి: + +![](https://betterexplained.com/wp-content/uploads/euler/equal_paths.png) + +Circle లో తిరగడానికి imaginary exponents వాడాల్సిందేనా? అక్కర్లేదు. కానీ అది సౌకర్యంగా, compact గా +ఉంటుంది. నిజమే, మన దారిని రెండు dimensions (real, imaginary) లో కలిసి జరిగే కదలికగా కూడా చెప్పొచ్చు, +కానీ పెద్ద విషయం మర్చిపోకండి: మనం జస్ట్ ఒక circle లో తిరుగుతున్నాం అంతే. + +**పూర్తి Transform ని కనుక్కోవడం** + +పెద్ద ఐడియా ఏంటంటే: మన signal అంటే కొన్ని time spikes కలిసినదే! ప్రతి time spike యొక్క recipes ని +కలిపేస్తే, పూర్తి signal యొక్క recipe వచ్చేస్తుంది. + +Fourier Transform ఒక్కో frequency దగ్గర recipe ని కడుతూ వెళ్తుంది: + +![](https://betterexplained.com/wp-content/uploads/images/fourier-explained-20121219-224649.png) + +కొన్ని notes: + +- N = మన దగ్గర ఉన్న time samples సంఖ్య +- n = ఇప్పుడు చూస్తున్న sample (0 ... N-1) +- xn = టైమ్ n దగ్గర signal value +- k = ఇప్పుడు చూస్తున్న frequency (0 Hertz నుంచి N-1 Hertz వరకు) +- Xk = signal లో frequency k ఎంత ఉంది (amplitude, phase — ఒక complex number) +- 1/N factor ని మామూలుగా reverse transform (frequencies నుంచి మళ్ళీ టైమ్ కి వెళ్ళేది) లోకి జరుపుతారు. అలా చేయొచ్చు, కానీ నాకు forward transform లో 1/N ఉండటమే ఇష్టం — ఎందుకంటే అది time spikes కి అసలు సైజ్ ఇస్తుంది. ఇంకా కావాలంటే రెండు transforms లోనూ 1/sqrt(N) వాడొచ్చు (forward, back రెండూ కలిపితే 1/N factor వస్తుంది). +- n/N అంటే టైమ్ లో ఎంత శాతం దాటేశాం అని. 2 _ pi _ k అంటే radians / sec లో మన speed. e^-ix అంటే వెనక్కి తిరిగే మన వృత్తాకార దారి. ఇవన్నీ కలిపితే, ఈ speed కి, ఈ టైమ్ కి మనం ఎంత దూరం కదిలాం అనేది వస్తుంది. +- Fourier Transform యొక్క అసలు equations "complex numbers ని కలపండి" అని మాత్రమే చెప్తాయి. చాలా programming languages complex numbers ని డైరెక్ట్ గా handle చేయలేవు, కాబట్టి అన్నిటినీ rectangular coordinates గా మార్చి కలపాలి. + +Stuart Riffle Fourier Transform కి ఒక అద్భుతమైన వివరణ ఇచ్చాడు: + +![](https://betterexplained.com/wp-content/uploads/images/DerivedDFT.png) + +## References + +- [Fourier Transform కి Interactive Guide](https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/) +- [YouTube లో Better Explained - DFT](https://www.youtube.com/watch?v=iN0VG9N2q0U&t=0s&index=77&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) +- [YouTube లో 3Blue1Brown - FT](https://www.youtube.com/watch?v=spUNpyF58BY&t=0s&index=76&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) +- [YouTube లో Simon Xu - FFT](https://www.youtube.com/watch?v=htCj9exbGo0&index=78&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&t=0s) +- Wikipedia + - [FT](https://en.wikipedia.org/wiki/Fourier_transform) + - [DFT](https://www.wikiwand.com/en/Discrete_Fourier_transform) + - [DTFT](https://en.wikipedia.org/wiki/Discrete-time_Fourier_transform) + - [FFT](https://www.wikiwand.com/en/Fast_Fourier_transform) diff --git a/src/algorithms/math/horner-method/README.md b/src/algorithms/math/horner-method/README.md index 991a674deb..7d38711687 100644 --- a/src/algorithms/math/horner-method/README.md +++ b/src/algorithms/math/horner-method/README.md @@ -1,5 +1,8 @@ # Horner's Method +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + In mathematics, Horner's method (or Horner's scheme) is an algorithm for polynomial evaluation. With this method, it is possible to evaluate a polynomial with only `n` additions and `n` multiplications. Hence, its storage requirements are `n` times the number of bits of `x`. Horner's method can be based on the following identity: diff --git a/src/algorithms/math/horner-method/README.tel-IN.md b/src/algorithms/math/horner-method/README.tel-IN.md new file mode 100644 index 0000000000..4b12547236 --- /dev/null +++ b/src/algorithms/math/horner-method/README.tel-IN.md @@ -0,0 +1,23 @@ +# Horner's Method + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Mathematics లో Horner's method (లేదా Horner's scheme) అనేది polynomial ని evaluate చేసే (value కనుక్కునే) algorithm. ఈ పద్ధతితో కేవలం `n` కూడికలు, `n` గుణకారాలతో polynomial ని evaluate చేయొచ్చు. కాబట్టి దీనికి కావాల్సిన storage, `x` లో ఉన్న bits కి `n` రెట్లు. + +Horner's method ఈ identity మీద బేస్ అయింది: + +![Horner's rule](https://wikimedia.org/api/rest_v1/media/math/render/svg/2a576e42d875496f8b0f0dda5ebff7c2415532e4) + +ఈ identity ని _Horner's rule_ అంటారు. + +పైన identity లో కుడి వైపు భాగాన్ని ఇచ్చిన `x` కి solve చేయడానికి, polynomial ని లోపలి నుంచి బయటికి iterate చేస్తూ, ప్రతి iteration result ని కూడబెడుతూ వెళ్తాం. `n` iterations తర్వాత (`n` అంటే polynomial order), కూడబెట్టిన result నే polynomial value. + +**ఈ polynomial తీసుకుంటే:** +`4 * x^4 + 2 * x^3 + 3 * x^2 + x^1 + 3` — దీన్ని `x = 2` దగ్గర evaluate చేయడానికి మామూలు పద్ధతి ఏంటంటే, దాన్ని `[3, 1, 3, 2, 4]` అనే array గా పెట్టి, దాని మీద iterate చేస్తూ ప్రతి iteration value ని ఒక accumulator లో save చేయడం, అంటే `acc += pow(x=2, index) * array[index]`. నిజానికి, ఒక నంబర్ power (`pow`) operation అంటే `n-1` గుణకారాలు. కాబట్టి ఈ పద్ధతిలో మొత్తం `14` operations జరుగుతాయి — `4` కూడికలు, `5` గుణకారాలు, `5` pows (ప్రతి power ని మళ్ళీ మళ్ళీ గుణించి లెక్కపెడతాం అనుకుంటే). + +ఇప్పుడు **అదే లెక్కని Horner's rule తో చేస్తే**, polynomial ని `x * (x * (x * (4 * x + 2) + 3) + 1) + 3` అని మళ్ళీ రాయొచ్చు. దాన్ని `[4, 2, 3, 1, 3]` గా పెడితే, మొదటి iteration ని `acc = arr[0] * (x=2) + arr[1]` గా save చేసి, తర్వాత iterations ని `acc *= (x=2) + arr[index]` తో పూర్తి చేయొచ్చు. Horner's rule తో అదే లెక్కకి మొత్తం `10` operations మాత్రమే జరుగుతాయి — కేవలం `4` కూడికలు, `4` గుణకారాలు. + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Horner%27s_method) diff --git a/src/algorithms/math/integer-partition/README.md b/src/algorithms/math/integer-partition/README.md index 6023e1505a..fb01048d0c 100644 --- a/src/algorithms/math/integer-partition/README.md +++ b/src/algorithms/math/integer-partition/README.md @@ -1,5 +1,8 @@ # Integer Partition +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + In number theory and combinatorics, a partition of a positive integer `n`, also called an **integer partition**, is a way of writing `n` as a sum of positive integers. diff --git a/src/algorithms/math/integer-partition/README.tel-IN.md b/src/algorithms/math/integer-partition/README.tel-IN.md new file mode 100644 index 0000000000..ff82507c45 --- /dev/null +++ b/src/algorithms/math/integer-partition/README.tel-IN.md @@ -0,0 +1,33 @@ +# Integer Partition + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Number theory, combinatorics లో, ఒక positive integer `n` యొక్క partition (దీన్నే +**integer partition** అంటారు) అంటే `n` ని positive integers మొత్తంగా రాసే ఒక పద్ధతి. + +కూడే నంబర్ల order మాత్రమే వేరుగా ఉన్న రెండు మొత్తాలని ఒకే partition గా చూస్తాం. +ఉదాహరణకి, `4` ని ఐదు వేరువేరు రకాలుగా partition చేయొచ్చు: + +``` +4 +3 + 1 +2 + 2 +2 + 1 + 1 +1 + 1 + 1 + 1 +``` + +Order ని బట్టి మారే composition `1 + 3` అనేది `3 + 1` తో ఒకే partition. అలాగే +`1 + 2 + 1`, `1 + 1 + 2` అనే రెండు వేరువేరు compositions ఒకే partition `2 + 1 + 1` ని +సూచిస్తాయి. + +`1` నుంచి `8` వరకు ఉన్న positive integers partitions కి సంబంధించిన Young diagrams. +Square యొక్క main diagonal దగ్గర అద్దంలో చూసినట్టు (reflection) తిప్పితే వచ్చే images, +conjugate partitions అయ్యేలా వీటిని పెట్టారు. + +![Integer Partition](https://upload.wikimedia.org/wikipedia/commons/d/d8/Ferrer_partitioning_diagrams.svg) + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Partition_(number_theory)) +- [YouTube](https://www.youtube.com/watch?v=ZaVM057DuzE&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/math/is-power-of-two/README.md b/src/algorithms/math/is-power-of-two/README.md index 6ed1e92568..107189e872 100644 --- a/src/algorithms/math/is-power-of-two/README.md +++ b/src/algorithms/math/is-power-of-two/README.md @@ -1,5 +1,8 @@ # Is a power of two +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + Given a positive integer, write a function to find if it is a power of two or not. diff --git a/src/algorithms/math/is-power-of-two/README.tel-IN.md b/src/algorithms/math/is-power-of-two/README.tel-IN.md new file mode 100644 index 0000000000..ec8a4c8666 --- /dev/null +++ b/src/algorithms/math/is-power-of-two/README.tel-IN.md @@ -0,0 +1,51 @@ +# Is a power of two + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +ఒక positive integer ఇస్తే, అది రెండు యొక్క power ఆ కాదా కనుక్కునే function రాయాలి. + +**Naive solution** + +Naive solution లో, నంబర్ `1` అయ్యేదాకా దాన్ని రెండుతో భాగిస్తూనే ఉంటాం, ప్రతిసారి +భాగించాక శేషం `0` వస్తుందా అని చెక్ చేస్తాం. రాకపోతే, ఆ నంబర్ రెండు యొక్క power కాదు. + +**Bitwise solution** + +Binary రూపంలో రెండు యొక్క powers కి ఎప్పుడూ ఒకే ఒక్క bit set అయి ఉంటుంది. +ఒక్క signed integer మాత్రమే దీనికి మినహాయింపు (ఉదాహరణకి -128 value ఉన్న 8-bit +signed integer ఇలా ఉంటుంది: `10000000`) + +``` +1: 0001 +2: 0010 +4: 0100 +8: 1000 +``` + +కాబట్టి నంబర్ zero కంటే పెద్దదా అని చెక్ చేశాక, ఒకే ఒక్క bit set అయి ఉందా అని test +చేయడానికి ఒక bitwise trick వాడొచ్చు. + +``` +number & (number - 1) +``` + +ఉదాహరణకి, నంబర్ `8` కి ఆ operations ఇలా ఉంటాయి: + +``` + 1000 +- 0001 + ---- + 0111 + + 1000 +& 0111 + ---- + 0000 +``` + +## References + +- [GeeksForGeeks](https://www.geeksforgeeks.org/program-to-find-whether-a-no-is-power-of-two/) +- [Stanford లో Bitwise Solution](http://www.graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2) +- [YouTube లో Binary number తీసివేత](https://www.youtube.com/watch?v=S9LJknZTyos&t=0s&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&index=66) diff --git a/src/algorithms/math/least-common-multiple/README.md b/src/algorithms/math/least-common-multiple/README.md index 3e49af9a5f..a7296f9118 100644 --- a/src/algorithms/math/least-common-multiple/README.md +++ b/src/algorithms/math/least-common-multiple/README.md @@ -1,5 +1,8 @@ # Least common multiple +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + In arithmetic and number theory, the least common multiple, lowest common multiple, or smallest common multiple of two integers `a` and `b`, usually denoted by `LCM(a, b)`, is diff --git a/src/algorithms/math/least-common-multiple/README.tel-IN.md b/src/algorithms/math/least-common-multiple/README.tel-IN.md new file mode 100644 index 0000000000..68f9ae1b88 --- /dev/null +++ b/src/algorithms/math/least-common-multiple/README.tel-IN.md @@ -0,0 +1,57 @@ +# Least common multiple + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Arithmetic, number theory లో, `a`, `b` అనే రెండు integers యొక్క least common multiple +(lowest common multiple, లేదా smallest common multiple అని కూడా అంటారు) ని మామూలుగా +`LCM(a, b)` అని రాస్తారు. అంటే `a`, `b` రెండిటితోనూ భాగించబడే అతి చిన్న positive integer. +Integers ని zero తో భాగించడం కుదరదు కాబట్టి, `a`, `b` రెండూ zero కాకపోతేనే ఈ definition కి +అర్థం ఉంటుంది. కానీ కొంతమంది authors అన్ని `a` లకి `lcm(a,0)` ని `0` గా define చేస్తారు — +divisibility lattice లో `lcm` ని least upper bound గా తీసుకుంటే అదే వస్తుంది. + +## Example + +4, 6 కి LCM ఎంత? + +`4` యొక్క multiples: + +``` +4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, ... +``` + +`6` యొక్క multiples: + +``` +6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, ... +``` + +`4`, `6` యొక్క common multiples అంటే రెండు lists లోనూ ఉన్న నంబర్లు: + +``` +12, 24, 36, 48, 60, 72, .... +``` + +కాబట్టి, `4`, `6` నంబర్ల మొదటి కొన్ని common multiples ఉన్న ఈ list నుంచి, వాటి least +common multiple `12`. + +## Least common multiple లెక్కపెట్టడం + +కింద ఉన్న formula తో least common multiple లెక్కని greatest common divisor (GCD) లెక్కగా +మార్చేయొచ్చు (GCD ని greatest common factor అని కూడా అంటారు): + +``` +lcm(a, b) = |a * b| / gcd(a, b) +``` + +![LCM](https://upload.wikimedia.org/wikipedia/commons/c/c9/Symmetrical_5-set_Venn_diagram_LCM_2_3_4_5_7.svg) + +`2`, `3`, `4`, `5`, `7` యొక్క combinations కి least common multiples చూపించే Venn diagram +(`6` ని వదిలేశారు, ఎందుకంటే అది `2 × 3`, ఆ రెండూ ఇప్పటికే ఉన్నాయి). + +ఉదాహరణకి, ఒక card game లో cards ని `5` మంది players వరకు సమానంగా పంచాలంటే కనీసం `60` +cards కావాలి — `2`, `3`, `4`, `5` sets కలిసే చోట ఉన్న నంబర్ అది, `7` set లో మాత్రం కాదు. + +## References + +[Wikipedia](https://en.wikipedia.org/wiki/Least_common_multiple) diff --git a/src/algorithms/math/liu-hui/README.md b/src/algorithms/math/liu-hui/README.md index c53257f8dd..ae817127a3 100644 --- a/src/algorithms/math/liu-hui/README.md +++ b/src/algorithms/math/liu-hui/README.md @@ -1,5 +1,8 @@ # Liu Hui's π Algorithm +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + Liu Hui remarked in his commentary to The Nine Chapters on the Mathematical Art, that the ratio of the circumference of an inscribed hexagon to the diameter of the circle was `three`, hence `π` must be greater than three. He went on to provide diff --git a/src/algorithms/math/liu-hui/README.tel-IN.md b/src/algorithms/math/liu-hui/README.tel-IN.md new file mode 100644 index 0000000000..3891133632 --- /dev/null +++ b/src/algorithms/math/liu-hui/README.tel-IN.md @@ -0,0 +1,81 @@ +# Liu Hui's π Algorithm + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Liu Hui తాను The Nine Chapters on the Mathematical Art కి రాసిన commentary లో ఒక విషయం చెప్పాడు — +circle లోపల గీసిన hexagon చుట్టుకొలతకి, circle diameter కి ratio `మూడు`, కాబట్టి `π` మూడు కంటే +ఎక్కువ ఉండాలి. తర్వాత polygons ని సగం చేస్తూ (bisect చేస్తూ) `π` ని ఎంత accuracy కావాలంటే అంత +accuracy తో లెక్కపెట్టే ఒక iterative algorithm ని step-by-step వివరంగా చెప్పాడు. 96-gon తో `π` ని +`3.141024`, `3.142708` మధ్యలో లెక్కపెట్టాడు. `3.14` సరిపోయేంత దగ్గరి విలువ అని చెప్పి, `π` ని `157/50` +గా రాశాడు; ఈ నంబర్ కొంచెం చిన్నదే అని ఒప్పుకున్నాడు. తర్వాత దాన్ని మెరుగుపరచడానికి ఒక తెలివైన +quick method కనిపెట్టి, కేవలం 96-gon తోనే `π ≈ 3.1416` తెచ్చాడు — దాని accuracy 1536-gon తో వచ్చే +దానికి సమానం. ఈ రంగంలో అతని అతి ముఖ్యమైన contribution, అతని సింపుల్ iterative `π` algorithm. + +## Circle area + +Liu Hui ఇలా వాదించాడు: + +> Hexagon యొక్క ఒక side ని (దాని చుట్టూ ఉన్న circle) radius తో గుణించి, దాన్ని మూడుతో గుణిస్తే +dodecagon area వస్తుంది; hexagon ని dodecagon గా కోసి, దాని side ని radius తో గుణించి, మళ్ళీ +ఆరుతో గుణిస్తే 24-gon area వస్తుంది; ఎంత సన్నగా కోస్తే circle area తో పోలిస్తే అంత తక్కువ నష్టం, +అలా కోస్తూ కోస్తూ పోతే, వచ్చే polygon area circle తో కలిసిపోయి ఒకటైపోతుంది; ఏ నష్టం ఉండదు + +![Liu Hui](https://upload.wikimedia.org/wikipedia/commons/6/69/Cutcircle2.svg) + +Circle area లెక్కపెట్టే Liu Hui పద్ధతి. + +ఇంకా, circle area అంటే దాని చుట్టుకొలతలో సగాన్ని radius తో గుణిస్తే వచ్చేది అని Liu Hui +prove చేశాడు. అతను ఇలా చెప్పాడు: + +> Polygon కి circle కి మధ్య కొంత ఎక్కువ radius ఉంటుంది. ఆ ఎక్కువ radius ని polygon యొక్క ఒక +side తో గుణించండి. వచ్చే area circle సరిహద్దు దాటిపోతుంది + +Diagram లో `d = ఎక్కువ radius`. `d` ని ఒక side తో గుణిస్తే `ABCD` అనే దీర్ఘచతురస్రం వస్తుంది, +అది circle సరిహద్దు దాటుతుంది. Polygon side చిన్నగా ఉంటే (అంటే sides చాలా ఎక్కువ ఉంటే), ఎక్కువ +radius కూడా చిన్నగా ఉంటుంది, కాబట్టి ఎక్కువ area కూడా చిన్నగా ఉంటుంది. + +> Polygon side ని దాని radius తో గుణిస్తే area రెట్టింపు అవుతుంది; కాబట్టి చుట్టుకొలతలో +సగాన్ని radius తో గుణిస్తే circle area వస్తుంది. + +![Liu Hui](https://upload.wikimedia.org/wikipedia/commons/9/95/Cutcircle.svg) + +Circle లోపలి area అంటే radius ని చుట్టుకొలతలో సగంతో గుణిస్తే వచ్చేది, అంటే `A = r x C/2 = r x r x π`. + +## Iterative algorithm + +Liu Hui circle లోపల గీసిన hexagon తో మొదలుపెట్టాడు. Hexagon యొక్క ఒక side `AB` పొడవు `M` +అనుకుందాం, `r` అంటే circle radius. + +![Liu Hui](https://upload.wikimedia.org/wikipedia/commons/4/46/Liuhui_geyuanshu.svg) + +`AB` ని `OPC` line తో సగం చేయండి, అప్పుడు `AC` అనేది dodecagon (12-gon) యొక్క ఒక side +అవుతుంది, దాని పొడవు `m` అనుకుందాం. `PC` పొడవు `j`, `OP` పొడవు `G` అనుకుందాం. + +`AOP`, `APC` అనేవి రెండు right angle triangles. Liu Hui [Gou Gu](https://en.wikipedia.org/wiki/Pythagorean_theorem) +(Pythagorean theorem) ని మళ్ళీ మళ్ళీ వాడాడు: + +![](https://wikimedia.org/api/rest_v1/media/math/render/svg/dbfc192c78539c3901c7bad470302ededb76f813) + +![](https://wikimedia.org/api/rest_v1/media/math/render/svg/ccd12a402367c2d6614c88e75006d50bfc3a9929) + +![](https://wikimedia.org/api/rest_v1/media/math/render/svg/65d77869fc02c302d2d46d45f75ad7e79ae524fb) + +![](https://wikimedia.org/api/rest_v1/media/math/render/svg/a7a0d0d7f505a0f434e5dd80c2fef6d2b30d6100) + +![](https://wikimedia.org/api/rest_v1/media/math/render/svg/c31b9acf38f9d1a248d4023c3bf286bd03007f37) + +![](https://wikimedia.org/api/rest_v1/media/math/render/svg/0dee798efb0b1e3e64d6b3542106cb3ecaa4a383) + +![](https://wikimedia.org/api/rest_v1/media/math/render/svg/3ffeafe88d2983b364ad3442746063e3207fe842) + + +ఇక్కడి నుంచి `M` నుంచి `m` కనుక్కునే technique వచ్చేసింది — దాంతో రెట్టింపు edges ఉన్న polygon +side పొడవు వస్తుంది. Hexagon తో మొదలుపెట్టి, ఈ formula తో Liu Hui dodecagon side పొడవు +కనుక్కోగలిగాడు. తర్వాత dodecagon side పొడవు నుంచి 24-gon side పొడవు, అలా మళ్ళీ మళ్ళీ +కనుక్కుంటూ వెళ్ళాడు. ఎన్నిసార్లు కావాలంటే అన్నిసార్లు recursive గా ఇలా చేయగలిగాడు. ఈ polygons +area ఎలా కనుక్కోవాలో తెలుసు కాబట్టి, Liu Hui `π` కి దగ్గరి విలువ కనుక్కోగలిగాడు. + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Liu_Hui%27s_%CF%80_algorithm) diff --git a/src/algorithms/math/matrix/README.md b/src/algorithms/math/matrix/README.md index 8e084403b0..f1649894cd 100644 --- a/src/algorithms/math/matrix/README.md +++ b/src/algorithms/math/matrix/README.md @@ -1,5 +1,8 @@ # Matrices +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + In mathematics, a **matrix** (plural **matrices**) is a rectangular array or table of numbers, symbols, or expressions, arranged in rows and columns. For example, the dimension of the matrix below is `2 × 3` (read "two by three"), because there are two rows and three columns: ``` diff --git a/src/algorithms/math/matrix/README.tel-IN.md b/src/algorithms/math/matrix/README.tel-IN.md new file mode 100644 index 0000000000..af57968da7 --- /dev/null +++ b/src/algorithms/math/matrix/README.tel-IN.md @@ -0,0 +1,66 @@ +# Matrices + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Mathematics లో **matrix** (బహువచనం **matrices**) అంటే rows, columns లో పెట్టిన నంబర్లు, symbols, లేదా expressions ఉన్న ఒక దీర్ఘచతురస్రాకార array లేదా table. ఉదాహరణకి, కింద ఉన్న matrix dimension `2 × 3` ("two by three" అని చదువుతారు), ఎందుకంటే అందులో రెండు rows, మూడు columns ఉన్నాయి: + +``` +| 1 9 -13 | +| 20 5 -6 | +``` + +![An `m × n` matrix](https://upload.wikimedia.org/wikipedia/commons/b/bf/Matris.png) + +ఒక `m × n` matrix: `m` rows అడ్డంగా (horizontal), `n` columns నిలువుగా (vertical) ఉంటాయి. Matrix లో ప్రతి element ని మామూలుగా రెండు subscripts ఉన్న variable తో చూపిస్తారు. ఉదాహరణకి, a2,1 అంటే matrix లో రెండో row, మొదటి column లో ఉన్న element + +## Matrices మీద operations + +### కూడిక (Addition) + +రెండు matrices ని కలపడానికి: ఒకే position లో ఉన్న నంబర్లని కలపండి: + +![Matrices addition](https://www.mathsisfun.com/algebra/images/matrix-addition.gif) + +రెండు matrices ఒకే సైజ్ లో ఉండాలి, అంటే rows సంఖ్య సమానంగా ఉండాలి, columns సంఖ్య కూడా సమానంగా ఉండాలి. + +### తీసివేత (Subtracting) + +రెండు matrices ని తీసివేయడానికి: ఒకే position లో ఉన్న నంబర్లని తీసివేయండి: + +![Matrices subtraction](https://www.mathsisfun.com/algebra/images/matrix-subtraction.gif) + +### Constant తో గుణించడం + +ఒక matrix ని ఒక constant తో గుణించొచ్చు (ఇక్కడ value 2): + +![Matrices multiplication be a constant](https://www.mathsisfun.com/algebra/images/matrix-multiply-constant.gif) + +### ఇంకో Matrix తో గుణించడం + +ఒక matrix ని ఇంకో matrix తో గుణించాలంటే rows, columns యొక్క [dot product](https://www.mathsisfun.com/algebra/vectors-dot-product.html) చేయాలి. + +**1st row**, **1st column** కి answer కనుక్కోవడానికి: + +![Matrices multiplication - 1st step](https://www.mathsisfun.com/algebra/images/matrix-multiply-a.svg) + +1st row, 2nd column కి ఇలా: + +![Matrices multiplication - 2st step](https://www.mathsisfun.com/algebra/images/matrix-multiply-b.svg) + +మిగతా rows, columns కి కూడా ఇలాగే చేస్తే, ఈ result matrix వస్తుంది: + +![Matrices multiplication - Result](https://www.mathsisfun.com/algebra/images/matrix-multiply-c.svg) + +### Transposing + +Matrix ని "transpose" చేయడానికి, rows ని columns గా, columns ని rows గా మార్చండి. + +Transpose అని చెప్పడానికి కుడి వైపు పైన ఒక "T" పెడతాం: + +![Transposing](https://www.mathsisfun.com/algebra/images/matrix-transpose.gif) + +## References + +- [MathIsFun లో Matrices](https://www.mathsisfun.com/algebra/matrix-introduction.html) +- [Wikipedia లో Matrix](https://en.wikipedia.org/wiki/Matrix_(mathematics)) diff --git a/src/algorithms/math/pascal-triangle/README.md b/src/algorithms/math/pascal-triangle/README.md index ff5075414c..649120938a 100644 --- a/src/algorithms/math/pascal-triangle/README.md +++ b/src/algorithms/math/pascal-triangle/README.md @@ -1,5 +1,8 @@ # Pascal's Triangle +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + In mathematics, **Pascal's triangle** is a triangular array of the [binomial coefficients](https://en.wikipedia.org/wiki/Binomial_coefficient). diff --git a/src/algorithms/math/pascal-triangle/README.tel-IN.md b/src/algorithms/math/pascal-triangle/README.tel-IN.md new file mode 100644 index 0000000000..f6afa9ffa4 --- /dev/null +++ b/src/algorithms/math/pascal-triangle/README.tel-IN.md @@ -0,0 +1,57 @@ +# Pascal's Triangle + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Mathematics లో **Pascal's triangle** అంటే [binomial coefficients](https://en.wikipedia.org/wiki/Binomial_coefficient) +ని త్రిభుజాకారంలో పెట్టిన array. + +Pascal's triangle rows ని మామూలుగా పైన row `n = 0` (`0th` row) నుంచి నంబర్ చేస్తారు. ప్రతి +row లో entries ని ఎడమ నుంచి `k = 0` తో మొదలుపెట్టి నంబర్ చేస్తారు, పక్కన ఉన్న rows లోని నంబర్లతో +పోలిస్తే ఇవి కొంచెం జరిపి (staggered) ఉంటాయి. Triangle ని ఇలా కట్టొచ్చు: row `0` (అన్నిటికంటే పైన +ఉన్న row) లో ఒకే ఒక్క nonzero entry `1` ఉంటుంది. తర్వాత ప్రతి row లో ప్రతి entry ని, దానికి పైన +ఎడమ వైపు ఉన్న నంబర్ ని, పైన కుడి వైపు ఉన్న నంబర్ తో కలిపి తయారుచేస్తాం — ఖాళీ entries ని `0` గా +తీసుకుంటాం. ఉదాహరణకి, మొదటి (లేదా ఏ) row లోనైనా మొదటి నంబర్ `1` (`0`, `1` మొత్తం), అలాగే మూడో +row లో ఉన్న `1`, `3` నంబర్లని కలిపితే నాలుగో row లో `4` వస్తుంది. + +![Pascal's Triangle](https://upload.wikimedia.org/wikipedia/commons/0/0d/PascalTriangleAnimated2.gif) + +## Formula + +Pascal's triangle లో `nth` row, `kth` column లో ఉన్న entry ని +![Formula](https://wikimedia.org/api/rest_v1/media/math/render/svg/206415d3742167e319b2e52c2ca7563b799abad7) అని రాస్తారు. +ఉదాహరణకి, అన్నిటికంటే పై row లో ఉన్న ఒకే ఒక్క nonzero entry +![Formula example](https://wikimedia.org/api/rest_v1/media/math/render/svg/b7e35f86368d5978b46c07fd6dddca86bd6e635c). + +ఈ notation తో, పైన paragraph లో చెప్పిన పద్ధతిని ఇలా రాయొచ్చు: + +![Formula](https://wikimedia.org/api/rest_v1/media/math/render/svg/203b128a098e18cbb8cf36d004bd7282b28461bf) + +ఇది negative కాని ఏ integer `n` కైనా, `0` నుంచి `n` మధ్య (రెండూ కలిపి) ఉన్న ఏ integer `k` కైనా +వర్తిస్తుంది. + +![Binomial Coefficient](https://wikimedia.org/api/rest_v1/media/math/render/svg/a2457a7ef3c77831e34e06a1fe17a80b84a03181) + +## Triangle entries ని O(n) టైమ్ లో లెక్కపెట్టడం + +`lineNumber` అనే line లో `i`-th entry అంటే Binomial Coefficient `C(lineNumber, i)` అని మనకి +తెలుసు, ఇంకా అన్ని lines `1` value తో మొదలవుతాయి. ఐడియా ఏంటంటే `C(lineNumber, i-1)` వాడి +`C(lineNumber, i)` లెక్కపెట్టడం. దీన్ని ఇలా `O(1)` టైమ్ లో లెక్కపెట్టొచ్చు: + +``` +C(lineNumber, i) = lineNumber! / ((lineNumber - i)! * i!) +C(lineNumber, i - 1) = lineNumber! / ((lineNumber - i + 1)! * (i - 1)!) +``` + +పైన రెండు expressions నుంచి ఈ expression తీసుకురావచ్చు: + +``` +C(lineNumber, i) = C(lineNumber, i - 1) * (lineNumber - i + 1) / i +``` + +కాబట్టి `C(lineNumber, i)` ని `C(lineNumber, i - 1)` నుంచి `O(1)` టైమ్ లో లెక్కపెట్టొచ్చు. + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Pascal%27s_triangle) +- [GeeksForGeeks](https://www.geeksforgeeks.org/pascal-triangle/) diff --git a/src/algorithms/math/primality-test/README.md b/src/algorithms/math/primality-test/README.md index 8a9852dc31..b4b1877351 100644 --- a/src/algorithms/math/primality-test/README.md +++ b/src/algorithms/math/primality-test/README.md @@ -1,5 +1,8 @@ # Primality Test +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + A **prime number** (or a **prime**) is a natural number greater than `1` that cannot be formed by multiplying two smaller natural numbers. A natural number greater than `1` that is not prime is called a composite number. For diff --git a/src/algorithms/math/primality-test/README.tel-IN.md b/src/algorithms/math/primality-test/README.tel-IN.md new file mode 100644 index 0000000000..d109c773dd --- /dev/null +++ b/src/algorithms/math/primality-test/README.tel-IN.md @@ -0,0 +1,23 @@ +# Primality Test + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +**Prime number** (లేదా **prime**) అంటే `1` కంటే పెద్దదైన natural number — దాన్ని రెండు చిన్న +natural numbers ని గుణించి తయారుచేయలేం. Prime కాని, `1` కంటే పెద్దదైన natural number ని +composite number అంటారు. ఉదాహరణకి, `5` prime — ఎందుకంటే దాన్ని గుణకారంగా రాయడానికి ఉన్న +పద్ధతులు `1 × 5` లేదా `5 × 1` మాత్రమే, రెండిట్లోనూ `5` నే ఉంది. కానీ `6` composite — ఎందుకంటే +అది `6` కంటే చిన్నవైన రెండు నంబర్ల `(2 × 3)` గుణకారం. + +![Prime Numbers](https://upload.wikimedia.org/wikipedia/commons/f/f0/Primes-vs-composites.svg) + +**Primality test** అంటే ఇచ్చిన నంబర్ prime ఆ కాదా అని నిర్ణయించే algorithm. Mathematics లో +చాలా రంగాలతో పాటు, cryptography లో దీన్ని వాడతారు. Integer factorization లాగా కాకుండా, +primality tests మామూలుగా prime factors ఇవ్వవు — ఇచ్చిన నంబర్ prime ఆ కాదా అని మాత్రమే చెప్తాయి. +Factorization ని computer కి కష్టమైన problem గా చూస్తారు, కానీ primality testing దానితో పోలిస్తే +ఈజీ (దాని running time input సైజ్ లో polynomial). + +## References + +- [Wikipedia లో Prime Numbers](https://en.wikipedia.org/wiki/Prime_number) +- [Wikipedia లో Primality Test](https://en.wikipedia.org/wiki/Primality_test) diff --git a/src/algorithms/math/prime-factors/README.md b/src/algorithms/math/prime-factors/README.md index d8e0f96e3f..6d32ca95d1 100644 --- a/src/algorithms/math/prime-factors/README.md +++ b/src/algorithms/math/prime-factors/README.md @@ -1,7 +1,8 @@ # Prime Factors _Read this in other languages:_ -[简体中文](README.zh-CN.md). +[简体中文](README.zh-CN.md), +[_తెలుగు_](README.tel-IN.md). **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. diff --git a/src/algorithms/math/prime-factors/README.tel-IN.md b/src/algorithms/math/prime-factors/README.tel-IN.md new file mode 100644 index 0000000000..ff244bc4d9 --- /dev/null +++ b/src/algorithms/math/prime-factors/README.tel-IN.md @@ -0,0 +1,38 @@ +# Prime Factors + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_简体中文_](README.zh-CN.md) + +**Prime number** అంటే `1` కంటే పెద్దదైన whole number — దాన్ని వేరే whole numbers ని గుణించి తయారుచేయడం **కుదరదు**. మొదటి కొన్ని prime numbers: `2`, `3`, `5`, `7`, `11`, `13`, `17`, `19` అలా. + +వేరే whole numbers ని గుణించి దాన్ని తయారుచేయడం **కుదిరితే** అది **Composite Number**. + +![Composite numbers](https://www.mathsisfun.com/numbers/images/prime-composite.svg) + +_Image source: [Math is Fun](https://www.mathsisfun.com/prime-factorization.html)_ + +**Prime factors** అంటే ఒకదానితో ఒకటి గుణిస్తే original number వచ్చే [prime numbers](https://en.wikipedia.org/wiki/Prime_number). ఉదాహరణకి `39` కి prime factors `3`, `13` — ఇవి రెండూ prime numbers. ఇంకో ఉదాహరణ `15`, దాని prime factors `3`, `5`. + +![Factors](https://www.mathsisfun.com/numbers/images/factor-2x3.svg) + +_Image source: [Math is Fun](https://www.mathsisfun.com/prime-factorization.html)_ + +## Prime factors ని, వాటి సంఖ్యని కరెక్ట్ గా కనుక్కోవడం + +పద్ధతి ఏంటంటే, natural number `n` ని `i = 2` నుంచి `i = n` వరకు ఉన్న indexes తో (prime indexes తో మాత్రమే) భాగిస్తూ వెళ్ళడం. ప్రతి iteration లో `n` value ని `(n / i)` తో మార్చేస్తాం. + +Loop index `i = 2` నుంచి `i = n` వరకు నడుస్తుంది కాబట్టి, ఇప్పటిదాకా worst case లో time complexity `O(n)`. ఈ time complexity ని `O(n)` నుంచి `O(sqrt(n))` కి తగ్గించొచ్చు. Loop ని `i = 2` నుంచి `i = sqrt(n)` వరకు నడిపితే ఈ optimisation వస్తుంది. ఇప్పుడు `O(sqrt(n))` వరకే వెళ్తాం — ఎందుకంటే `i` అనేది `sqrt(n)` కంటే పెద్దది అయ్యాక, `n` ని పూర్తిగా భాగించే index `i` (`n` తప్ప) ఇంకేమీ మిగలదు అని కన్ఫర్మ్ గా తెలుసు. + +## Prime-factor సంఖ్యని దాదాపుగా లెక్కపెట్టే Hardy-Ramanujan formula + +1917 లో G.H Hardy, Srinivasa Ramanujan ఒక theorem తయారుచేశారు — ఒక నంబర్ `n` కి ఉన్న వేరువేరు prime factors సంఖ్య `ω(n)` యొక్క normal order `log(log(n))` అని అది చెప్తుంది. + +సింపుల్ గా చెప్పాలంటే, చాలా నంబర్లకి దాదాపు ఇన్ని వేరువేరు prime factors ఉంటాయి అని అర్థం. + +## References + +- [Math is Fun లో Prime numbers](https://www.mathsisfun.com/prime-factorization.html) +- [Wikipedia లో Prime numbers](https://en.wikipedia.org/wiki/Prime_number) +- [Wikipedia లో Hardy–Ramanujan theorem](https://en.wikipedia.org/wiki/Hardy%E2%80%93Ramanujan_theorem) +- [Youtube లో ఒక నంబర్ యొక్క Prime factorization](https://www.youtube.com/watch?v=6PDtgHhpCHo&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&index=82) diff --git a/src/algorithms/math/prime-factors/README.zh-CN.md b/src/algorithms/math/prime-factors/README.zh-CN.md index c6ab82e39b..1d6807b745 100644 --- a/src/algorithms/math/prime-factors/README.zh-CN.md +++ b/src/algorithms/math/prime-factors/README.zh-CN.md @@ -1,7 +1,8 @@ # 质数因子 _Read this in other languages:_ -[english](README.md). +[english](README.md), +[_తెలుగు_](README.tel-IN.md). **质数** 是一个比 `1` 大的整数,且 **不能**由其它整数相乘得出。前几个质数是: `2`, `3`, `5`, `7`, `11`, `13`, `17`, `19`,依此类推。 diff --git a/src/algorithms/math/radian/README.md b/src/algorithms/math/radian/README.md index 2de4655e7d..5164755e8d 100644 --- a/src/algorithms/math/radian/README.md +++ b/src/algorithms/math/radian/README.md @@ -1,5 +1,8 @@ # Radian +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + The **radian** (symbol **rad**) is the unit for measuring angles, and is the standard unit of angular measure used in many areas of mathematics. diff --git a/src/algorithms/math/radian/README.tel-IN.md b/src/algorithms/math/radian/README.tel-IN.md new file mode 100644 index 0000000000..74843fd3d3 --- /dev/null +++ b/src/algorithms/math/radian/README.tel-IN.md @@ -0,0 +1,39 @@ +# Radian + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +**Radian** (symbol **rad**) అనేది angles ని కొలిచే unit. Mathematics లో చాలా రంగాల్లో angles +కొలవడానికి ఇదే standard unit. + +Unit circle లో ఒక arc (వంపు) పొడవు, అది ఏర్పరిచే angle ని radians లో కొలిస్తే వచ్చే నంబర్ కి +సమానం; ఒక radian అంటే `57.3` degrees కంటే కొంచెం తక్కువ. + +ఒక circle radius ఎంత పొడవు ఉందో, అంతే పొడవు ఉన్న arc ఏర్పరిచే angle `1 radian`. మొత్తం +చుట్టుకొలత ఏర్పరిచే angle `2π radians`. + +![Radian](https://upload.wikimedia.org/wikipedia/commons/4/4e/Circle_radians.gif) + +ఒక పూర్తి రౌండ్ అంటే 2π radians (ఇక్కడ radius ఒకటి ఉన్న circle తో చూపించారు, కాబట్టి +చుట్టుకొలత `2π`). + +![2 pi Radian](https://upload.wikimedia.org/wikipedia/commons/6/67/2pi-unrolled.gif) + +**Conversions (మార్పులు)** + +| Radians | Degrees | +| :-----: | :-----: | +| 0 | 0° | +| π/12 | 15° | +| π/6 | 30° | +| π/4 | 45° | +| 1 | 57.3° | +| π/3 | 60° | +| π/2 | 90° | +| π | 180° | +| 2π | 360° | + + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Radian) diff --git a/src/algorithms/math/sieve-of-eratosthenes/README.md b/src/algorithms/math/sieve-of-eratosthenes/README.md index 876379a006..90646028a0 100644 --- a/src/algorithms/math/sieve-of-eratosthenes/README.md +++ b/src/algorithms/math/sieve-of-eratosthenes/README.md @@ -1,5 +1,8 @@ # Sieve of Eratosthenes +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + The Sieve of Eratosthenes is an algorithm for finding all prime numbers up to some limit `n`. It is attributed to Eratosthenes of Cyrene, an ancient Greek mathematician. diff --git a/src/algorithms/math/sieve-of-eratosthenes/README.tel-IN.md b/src/algorithms/math/sieve-of-eratosthenes/README.tel-IN.md new file mode 100644 index 0000000000..85d62a118f --- /dev/null +++ b/src/algorithms/math/sieve-of-eratosthenes/README.tel-IN.md @@ -0,0 +1,34 @@ +# Sieve of Eratosthenes + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Sieve of Eratosthenes అనేది ఒక limit `n` వరకు ఉన్న అన్ని prime numbers కనుక్కునే algorithm. + +దీన్ని పురాతన గ్రీకు mathematician అయిన Cyrene కి చెందిన Eratosthenes కనిపెట్టాడు అంటారు. + +## ఇది ఎలా పనిచేస్తుంది + +1. `n + 1` positions ఉన్న ఒక boolean array తయారుచేయండి (`0` నుంచి `n` వరకు ఉన్న నంబర్ల కోసం) +2. Positions `0`, `1` ని `false` గా, మిగతావన్నీ `true` గా పెట్టండి +3. Position `p = 2` (మొదటి prime number) నుంచి మొదలుపెట్టండి +4. `p` యొక్క అన్ని multiples ని `false` గా mark చేయండి (అంటే positions `2 * p`, `3 * p`, `4 * p`... array చివరి వరకు) +5. Array లో `p` కంటే పెద్దదైన, `true` గా ఉన్న మొదటి position కనుక్కోండి. అలాంటి position లేకపోతే, ఆపేయండి. ఉంటే, `p` ని ఈ కొత్త నంబర్ (అదే next prime) గా పెట్టి, step 4 నుంచి మళ్ళీ చేయండి + +Algorithm అయిపోయాక, array లో `true` గా మిగిలిన నంబర్లన్నీ `n` కంటే తక్కువ ఉన్న primes. + +ఈ algorithm ని ఇంకా మెరుగుపరచడానికి, step 4 లో `p` యొక్క multiples ని `2 * p` నుంచి కాకుండా +`p * p` నుంచి mark చేయడం మొదలుపెట్టొచ్చు. ఇది ఎందుకు పనిచేస్తుందంటే, ఆ టైమ్ కి `p` యొక్క +చిన్న multiples ఇప్పటికే `false` గా mark అయిపోయి ఉంటాయి. + +## Example + +![Sieve](https://upload.wikimedia.org/wikipedia/commons/b/b9/Sieve_of_Eratosthenes_animation.gif) + +## Complexity + +ఈ algorithm complexity `O(n log(log n))`. + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes) diff --git a/src/algorithms/math/square-root/README.md b/src/algorithms/math/square-root/README.md index 7f9713b5f6..39962f7565 100644 --- a/src/algorithms/math/square-root/README.md +++ b/src/algorithms/math/square-root/README.md @@ -1,5 +1,8 @@ # Square Root (Newton's Method) +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + In numerical analysis, a branch of mathematics, there are several square root algorithms or methods of computing the principal square root of a non-negative real number. As, generally, the roots of a function cannot be computed exactly. diff --git a/src/algorithms/math/square-root/README.tel-IN.md b/src/algorithms/math/square-root/README.tel-IN.md new file mode 100644 index 0000000000..c99c3eb811 --- /dev/null +++ b/src/algorithms/math/square-root/README.tel-IN.md @@ -0,0 +1,62 @@ +# Square Root (Newton's Method) + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Mathematics లో ఒక భాగమైన numerical analysis లో, negative కాని real number యొక్క principal +square root లెక్కపెట్టడానికి చాలా square root algorithms లేదా methods ఉన్నాయి. ఎందుకంటే, +మామూలుగా ఒక function యొక్క roots ని exact గా లెక్కపెట్టలేం. Root-finding algorithms roots కి +దగ్గరి విలువలని floating point numbers గా ఇస్తాయి. + +![](https://wikimedia.org/api/rest_v1/media/math/render/svg/bff86975b0e7944720b3e635c53c22c032a7a6f1) కనుక్కోవడం అంటే, +positive `x` కోసం ![](https://wikimedia.org/api/rest_v1/media/math/render/svg/6cf57722151ef19ba1ca918d702b95c335e21cad) అనే +equation ని solve చేయడమే. కాబట్టి, ఏ జనరల్ numerical root-finding algorithm అయినా వాడొచ్చు. + +**Newton's method** (దీన్నే Newton–Raphson method అని కూడా అంటారు) — _Isaac Newton_, +_Joseph Raphson_ పేర్ల మీద వచ్చింది — root-finding algorithm కి ఒక ఉదాహరణ. Real-valued +function యొక్క roots కి ప్రతిసారి ఇంకా దగ్గరి విలువలు కనుక్కునే పద్ధతి ఇది. + +ముందు Newton's method జనరల్ ఐడియా explain చేసి, తర్వాత దాన్ని మన case కి — ఒక నంబర్ square +root కనుక్కోవడానికి — వాడదాం. + +## Newton's Method జనరల్ ఐడియా + +ఒక variable ఉన్న Newton–Raphson method ఇలా పనిచేస్తుంది: + +Real numbers `x` మీద define చేసిన ఒక function `f`, ఆ function derivative `f'`, ఇంకా function `f` +యొక్క root కి ఒక మొదటి అంచనా (initial guess) `x0` తో ఈ method మొదలవుతుంది. Formula తీసుకురావడానికి +అనుకున్న conditions కి function సరిపోతే, ఇంకా initial guess దగ్గరగా ఉంటే, ఇంకా మంచి అంచనా `x1` ఇది: + +![](https://wikimedia.org/api/rest_v1/media/math/render/svg/52c50eca0b7c4d64ef2fdca678665b73e944cb84) + +Geometry పరంగా చూస్తే, `(x0, f (x0))` దగ్గర `f` graph కి గీసిన tangent, `x`-axis ని కలిసే చోటే `(x1, 0)`. + +ఈ process ని ఇలా మళ్ళీ మళ్ళీ చేస్తాం: + +![](https://wikimedia.org/api/rest_v1/media/math/render/svg/710c11b9ec4568d1cfff49b7c7d41e0a7829a736) + +సరిపోయేంత accurate value వచ్చేదాకా. + +![](https://upload.wikimedia.org/wikipedia/commons/e/e0/NewtonIteration_Ani.gif) + +## Newton's Method తో Square Root కనుక్కోవడం + +పైన చెప్పినట్టు, ![](https://wikimedia.org/api/rest_v1/media/math/render/svg/bff86975b0e7944720b3e635c53c22c032a7a6f1) కనుక్కోవడం అంటే, +positive `x` కోసం ![](https://wikimedia.org/api/rest_v1/media/math/render/svg/6cf57722151ef19ba1ca918d702b95c335e21cad) అనే +equation ని solve చేయడమే. + +Square root problem లో function `f(x)` యొక్క derivative `2x`. + +Newton's formula (పైన చూడండి) వాడితే, మన algorithm iterations కి ఈ equation వస్తుంది: + +```text +x := x - (x² - S) / (2x) +``` + +పైన ఉన్న `x² − S` అంటే `x²` ఉండాల్సిన చోటు నుంచి ఎంత దూరంలో ఉంది అని. `2x` తో భాగించడం అంటే +`x²` యొక్క derivative — `x²` ఎంత ఫాస్ట్ గా మారుతుందో దాన్ని బట్టి `x` ని ఎంత మార్చాలో scale చేయడానికి. + +## References + +- [Wikipedia లో Square roots లెక్కపెట్టే పద్ధతులు](https://en.wikipedia.org/wiki/Methods_of_computing_square_roots) +- [Wikipedia లో Newton's method](https://en.wikipedia.org/wiki/Newton%27s_method) diff --git a/src/algorithms/ml/k-means/README.md b/src/algorithms/ml/k-means/README.md index fb58c1bfa4..1327679eeb 100644 --- a/src/algorithms/ml/k-means/README.md +++ b/src/algorithms/ml/k-means/README.md @@ -1,7 +1,8 @@ # k-Means Algorithm _Read this in other languages:_ -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) The **k-Means algorithm** is an unsupervised Machine Learning algorithm. It's a clustering algorithm, which groups the sample data on the basis of similarity between dimensions of vectors. diff --git a/src/algorithms/ml/k-means/README.pt-BR.md b/src/algorithms/ml/k-means/README.pt-BR.md index d814ac19bc..9343f434b4 100644 --- a/src/algorithms/ml/k-means/README.pt-BR.md +++ b/src/algorithms/ml/k-means/README.pt-BR.md @@ -1,7 +1,8 @@ # Algoritmo k-Means _Leia isso em outros idiomas:_ -[_English_](README.md) +[_English_](README.md), +[_తెలుగు_](README.tel-IN.md) O **algoritmo k-Means** é um algoritmo de aprendizado de máquina não supervisionado. É um algoritmo de agrupamento, que agrupa os dados da amostra com base na semelhança entre as dimensões dos vetores. diff --git a/src/algorithms/ml/k-means/README.tel-IN.md b/src/algorithms/ml/k-means/README.tel-IN.md new file mode 100644 index 0000000000..764fb54dc1 --- /dev/null +++ b/src/algorithms/ml/k-means/README.tel-IN.md @@ -0,0 +1,41 @@ +# k-Means Algorithm + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Português_](README.pt-BR.md) + +**k-Means algorithm** అనేది ఒక unsupervised Machine Learning algorithm. ఇది ఒక clustering algorithm — vectors dimensions మధ్య ఉన్న పోలికని బట్టి sample data ని groups గా చేస్తుంది. + +k-Means classification లో, output అనేది ప్రతి vector కి ఇచ్చిన classes సెట్. ప్రతి cluster location ని నిరంతరం optimize చేస్తూ ఉంటారు — ఎందుకంటే ప్రతి cluster కి కరెక్ట్ location రావాలి, అది ప్రతి group ని క్లియర్ గా చూపించాలి. + +ఐడియా ఏంటంటే — cluster location కి, data vectors కి మధ్య పోలిక (similarity) లెక్కపెట్టి, దాన్ని బట్టి clusters ని మళ్ళీ కేటాయించడం. దీనికి ఎక్కువగా [Euclidean distance](https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/math/euclidean-distance) వాడతారు. + +![Euclidean distance between two points](https://upload.wikimedia.org/wikipedia/commons/5/55/Euclidean_distance_2d.svg) + +_Image source: [Wikipedia](https://en.wikipedia.org/wiki/Euclidean_distance)_ + +Algorithm ఇలా ఉంటుంది: + +1. Invalid/సరిగ్గా లేని data లాంటి errors చెక్ చేయండి +2. `k` cluster locations ని మొదటి/random `k` points తో initialize చేయండి +3. ప్రతి data point కి ప్రతి cluster నుంచి దూరం లెక్కపెట్టండి +4. ప్రతి data point కి, దానికి అతి దగ్గరగా ఉన్న cluster label నే ఇవ్వండి +5. ప్రతి cluster లో ఉన్న data points ని బట్టి దాని centroid (మధ్య బిందువు) లెక్కపెట్టండి +6. Centroid locations మారుతున్నంత వరకు పైన steps అన్నీ మళ్ళీ మళ్ళీ చేయండి + +ఇంకా బాగా అర్థమవ్వడానికి k-Means clustering visualization ఇది: + +![KNN Visualization 1](https://upload.wikimedia.org/wikipedia/commons/e/ea/K-means_convergence.gif) + +_Image source: [Wikipedia](https://en.wikipedia.org/wiki/K-means_clustering)_ + +వేరువేరు data points sets మధ్య ఇంకా బాగా తేడా తీసుకురావడానికి centroids నిరంతరం కదులుతూ ఉంటాయి. చూడొచ్చు — కొన్ని iterations తర్వాత, iterations మధ్య centroids లో తేడా చాలా తక్కువగా ఉంటుంది. ఉదాహరణకి iterations `13`, `14` మధ్య తేడా చాలా చిన్నది — ఎందుకంటే అక్కడ optimizer అంచుల దగ్గర ఉన్న cases ని సరిచేస్తోంది. + +## Code Examples + +- [kMeans.js](./kMeans.js) +- [kMeans.test.js](./__test__/kMeans.test.js) (test cases) + +## References + +- [Wikipedia లో k-Means algorithm](https://en.wikipedia.org/wiki/K-means_clustering) diff --git a/src/algorithms/ml/knn/README.md b/src/algorithms/ml/knn/README.md index 1fc168eaf2..be5484b881 100644 --- a/src/algorithms/ml/knn/README.md +++ b/src/algorithms/ml/knn/README.md @@ -1,7 +1,8 @@ # k-Nearest Neighbors Algorithm _Read this in other languages:_ -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) The **k-nearest neighbors algorithm (k-NN)** is a supervised Machine Learning algorithm. It's a classification algorithm, determining the class of a sample vector using a sample data. diff --git a/src/algorithms/ml/knn/README.pt-BR.md b/src/algorithms/ml/knn/README.pt-BR.md index b2abdd784f..eda2b275e9 100644 --- a/src/algorithms/ml/knn/README.pt-BR.md +++ b/src/algorithms/ml/knn/README.pt-BR.md @@ -1,7 +1,8 @@ # Algoritmo de k-vizinhos mais próximos _Leia isso em outros idiomas:_ -[_English_](README.md) +[_English_](README.md), +[_తెలుగు_](README.tel-IN.md) O **algoritmo de k-vizinhos mais próximos (k-NN)** é um algoritmo de aprendizado de máquina supervisionado. É um algoritmo de classificação, determinando a classe de um vetor de amostra usando dados de amostra. diff --git a/src/algorithms/ml/knn/README.tel-IN.md b/src/algorithms/ml/knn/README.tel-IN.md new file mode 100644 index 0000000000..79a1104c8a --- /dev/null +++ b/src/algorithms/ml/knn/README.tel-IN.md @@ -0,0 +1,45 @@ +# k-Nearest Neighbors Algorithm + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Português_](README.pt-BR.md) + +**k-nearest neighbors algorithm (k-NN)** అనేది ఒక supervised Machine Learning algorithm. ఇది ఒక classification algorithm — sample data వాడి ఒక sample vector ఏ class కి చెందుతుందో నిర్ణయిస్తుంది. + +k-NN classification లో output అంటే ఏ class కి చెందుతుంది అని. ఒక object ని దాని neighbors ఎక్కువ votes తో classify చేస్తారు — ఆ object ని దాని `k` nearest neighbors లో ఎక్కువమంది ఏ class లో ఉన్నారో ఆ class కే ఇస్తారు (`k` అనేది ఒక positive integer, మామూలుగా చిన్నది). `k = 1` అయితే, ఆ object ని దానికి అతి దగ్గరగా ఉన్న ఒక్క neighbor class కే ఇస్తారు. + +ఐడియా ఏంటంటే — ఒక distance metric ని బట్టి రెండు data points మధ్య పోలిక లెక్కపెట్టడం. దీనికి ఎక్కువగా [Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance) వాడతారు. + +![Euclidean distance between two points](https://upload.wikimedia.org/wikipedia/commons/5/55/Euclidean_distance_2d.svg) + +_Image source: [Wikipedia](https://en.wikipedia.org/wiki/Euclidean_distance)_ + +Algorithm ఇలా ఉంటుంది: + +1. Invalid data/labels లాంటి errors చెక్ చేయండి. +2. Training data లో ఉన్న అన్ని data points కి, classify చేయాల్సిన point కి మధ్య euclidean distance లెక్కపెట్టండి +3. Points distances ని వాటి classes తో సహా చిన్న నుంచి పెద్ద వరుసలో sort చేయండి +4. మొదటి `K` classes తీసుకుని, వాటిలో ఎక్కువసార్లు వచ్చిన (mode) class కనుక్కోండి — అదే అతి దగ్గరి class +5. ఆ అతి దగ్గరి class ని చెప్పండి + +ఇంకా బాగా అర్థమవ్వడానికి k-NN classification visualization ఇది: + +![KNN Visualization 1](https://upload.wikimedia.org/wikipedia/commons/e/e7/KnnClassification.svg) + +_Image source: [Wikipedia](https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm)_ + +Test sample (ఆకుపచ్చ చుక్క) ని నీలం squares కి గానీ ఎర్ర triangles కి గానీ classify చేయాలి. `k = 3` (గట్టి గీత circle) అయితే దాన్ని ఎర్ర triangles కి ఇస్తారు — ఎందుకంటే లోపలి circle లో `2` triangles, `1` square మాత్రమే ఉన్నాయి. `k = 5` (చుక్కల గీత circle) అయితే దాన్ని నీలం squares కి ఇస్తారు (బయటి circle లో `3` squares, `2` triangles). + +ఇంకో k-NN classification example: + +![KNN Visualization 2](https://media.geeksforgeeks.org/wp-content/uploads/graph2-2.png) + +_Image source: [GeeksForGeeks](https://media.geeksforgeeks.org/wp-content/uploads/graph2-2.png)_ + +ఇక్కడ చూడొచ్చు — తెలియని points ని, అవి వేరే points కి ఎంత దగ్గరగా ఉన్నాయో దాన్ని బట్టి classify చేస్తారు. + +ఒక విషయం గమనించాలి — tie (సమానం) అవ్వకుండా ఉండటానికి `K` కి odd values ఇవ్వడం మంచిది. మామూలుగా `K` ని `3` లేదా `5` గా తీసుకుంటారు. + +## References + +- [Wikipedia లో k-nearest neighbors algorithm](https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm) diff --git a/src/algorithms/search/binary-search/README.es-ES.md b/src/algorithms/search/binary-search/README.es-ES.md index f14aef985f..a3fe910179 100644 --- a/src/algorithms/search/binary-search/README.es-ES.md +++ b/src/algorithms/search/binary-search/README.es-ES.md @@ -2,7 +2,8 @@ _Lea esto en otros idiomas:_ [English](README.md) -[Português brasileiro](README.pt-BR.md). +[Português brasileiro](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.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 diff --git a/src/algorithms/search/binary-search/README.md b/src/algorithms/search/binary-search/README.md index 34d1bd7a40..6a25f5b789 100644 --- a/src/algorithms/search/binary-search/README.md +++ b/src/algorithms/search/binary-search/README.md @@ -2,7 +2,8 @@ _Read this in other languages:_ [Português brasileiro](README.pt-BR.md). -[Español](README.es-ES.md). +[Español](README.es-ES.md), +[_తెలుగు_](README.tel-IN.md). In computer science, binary search, also known as half-interval search, logarithmic search, or binary chop, is a search algorithm diff --git a/src/algorithms/search/binary-search/README.pt-BR.md b/src/algorithms/search/binary-search/README.pt-BR.md index 4f9de9f199..80aa5c1d13 100644 --- a/src/algorithms/search/binary-search/README.pt-BR.md +++ b/src/algorithms/search/binary-search/README.pt-BR.md @@ -2,7 +2,8 @@ _Leia isso em outras línguas:_ [english](README.md). -[Español](README.es-ES.md). +[Español](README.es-ES.md), +[_తెలుగు_](README.tel-IN.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 que encontra a posição de um elemento alvo dentro de um diff --git a/src/algorithms/search/binary-search/README.tel-IN.md b/src/algorithms/search/binary-search/README.tel-IN.md new file mode 100644 index 0000000000..909ad29dae --- /dev/null +++ b/src/algorithms/search/binary-search/README.tel-IN.md @@ -0,0 +1,25 @@ +# Binary Search + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Português brasileiro_](README.pt-BR.md), +[_Español_](README.es-ES.md) + +Computer science లో binary search (దీన్నే half-interval search, logarithmic search, లేదా +binary chop అని కూడా అంటారు) అనేది sort అయిన array లో ఒక target value ఎక్కడ ఉందో కనుక్కునే +search algorithm. Binary search target value ని array మధ్యలో ఉన్న element తో compare చేస్తుంది; +అవి సమానం కాకపోతే, target ఉండే chance లేని సగాన్ని పక్కన పెట్టేసి, మిగిలిన సగంలో search +కంటిన్యూ చేస్తుంది — దొరికేదాకా. మిగిలిన సగం ఖాళీ అయిపోయి search ముగిస్తే, target array లో లేదు +అని అర్థం. + +![Binary Search](https://upload.wikimedia.org/wikipedia/commons/8/83/Binary_Search_Depiction.svg) + +## Complexity + +**Time Complexity**: `O(log(n))` - ఎందుకంటే ప్రతి next iteration లో search area ని రెండుగా +విడగొడతాం. + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Binary_search_algorithm) +- [YouTube](https://www.youtube.com/watch?v=P3YID7liBug&index=29&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/search/interpolation-search/README.md b/src/algorithms/search/interpolation-search/README.md index e91154a8ff..1feb301863 100644 --- a/src/algorithms/search/interpolation-search/README.md +++ b/src/algorithms/search/interpolation-search/README.md @@ -1,5 +1,8 @@ # Interpolation Search +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + **Interpolation search** is an algorithm for searching for a key in an array that has been ordered by numerical values assigned to the keys (key values). diff --git a/src/algorithms/search/interpolation-search/README.tel-IN.md b/src/algorithms/search/interpolation-search/README.tel-IN.md new file mode 100644 index 0000000000..9242b02422 --- /dev/null +++ b/src/algorithms/search/interpolation-search/README.tel-IN.md @@ -0,0 +1,45 @@ +# Interpolation Search + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +**Interpolation search** అనేది ఒక array లో key కోసం వెతికే algorithm — ఆ array, keys కి ఇచ్చిన +numerical values (key values) ని బట్టి order లో పెట్టి ఉంటుంది. + +ఉదాహరణకి, సమానంగా పంచబడిన (uniformly distributed) `n` values ఉన్న sorted array `arr[]` మన దగ్గర +ఉంది, అందులో ఒక particular element `x` కోసం వెతికే function రాయాలి. + +**Linear Search** element ని `O(n)` టైమ్ లో కనుక్కుంటుంది, **Jump Search** కి `O(√ n)` టైమ్ పడుతుంది, +**Binary Search** కి `O(Log n)` టైమ్ పడుతుంది. + +Sorted array లో values _సమానంగా_ పంచబడి ఉన్నప్పుడు, **Interpolation Search** అనేది Binary Search కంటే +బెటర్. Binary Search ఎప్పుడూ మధ్యలో ఉన్న element దగ్గరికే వెళ్ళి చెక్ చేస్తుంది. కానీ interpolation +search, వెతుకుతున్న key value ని బట్టి వేరువేరు locations కి వెళ్ళొచ్చు. ఉదాహరణకి, key value చివరి +element కి దగ్గరగా ఉంటే, interpolation search చివరి వైపు నుంచే search మొదలుపెట్టే chance ఎక్కువ. + +ఎక్కడ వెతకాలో position కనుక్కోవడానికి ఈ formula వాడుతుంది: + +``` +// The idea of formula is to return higher value of pos +// when element to be searched is closer to arr[hi]. And +// smaller value when closer to arr[lo] +pos = lo + ((x - arr[lo]) * (hi - lo) / (arr[hi] - arr[Lo])) + +arr[] - Array where elements need to be searched +x - Element to be searched +lo - Starting index in arr[] +hi - Ending index in arr[] +``` + +(ఈ formula ఐడియా ఏంటంటే — వెతికే element `arr[hi]` కి దగ్గరగా ఉంటే `pos` కి పెద్ద value, `arr[lo]` కి +దగ్గరగా ఉంటే చిన్న value ఇవ్వడం. ఇక్కడ `arr[]` అంటే వెతకాల్సిన array, `x` అంటే వెతకాల్సిన element, +`lo` అంటే `arr[]` లో మొదటి index, `hi` అంటే `arr[]` లో చివరి index.) + +## Complexity + +**Time complexity**: `O(log(log(n))` + +## References + +- [GeeksForGeeks](https://www.geeksforgeeks.org/interpolation-search/) +- [Wikipedia](https://en.wikipedia.org/wiki/Interpolation_search) diff --git a/src/algorithms/search/jump-search/README.md b/src/algorithms/search/jump-search/README.md index b711a7732d..68297546ff 100644 --- a/src/algorithms/search/jump-search/README.md +++ b/src/algorithms/search/jump-search/README.md @@ -1,5 +1,8 @@ # Jump Search +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + Like Binary Search, **Jump Search** (or **Block Search**) is a searching algorithm for sorted arrays. The basic idea is to check fewer elements (than linear search) by jumping ahead by fixed steps or skipping some elements in place of searching all diff --git a/src/algorithms/search/jump-search/README.tel-IN.md b/src/algorithms/search/jump-search/README.tel-IN.md new file mode 100644 index 0000000000..b023fe19d2 --- /dev/null +++ b/src/algorithms/search/jump-search/README.tel-IN.md @@ -0,0 +1,28 @@ +# Jump Search + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Binary Search లాగానే, **Jump Search** (లేదా **Block Search**) కూడా sort అయిన arrays కోసం వాడే +searching algorithm. బేసిక్ ఐడియా ఏంటంటే — అన్ని elements వెతకకుండా, fixed steps తో ముందుకి +దూకుతూ లేదా కొన్ని elements ని skip చేస్తూ, (linear search కంటే) తక్కువ elements చెక్ చేయడం. + +ఉదాహరణకి, మన దగ్గర `n` సైజ్ ఉన్న array `arr[]`, `m` సైజ్ ఉన్న block (దూకాల్సింది) ఉన్నాయి అనుకుందాం. +అప్పుడు `arr[0]`, `arr[m]`, `arr[2 * m]`, ..., `arr[k * m]` అలా indexes దగ్గర వెతుకుతాం. +`arr[k * m] < x < arr[(k+1) * m]` అనే interval దొరికాక, element `x` కోసం index `k * m` నుంచి +linear search చేస్తాం. + +**ఎంత block సైజ్ skip చేస్తే బెస్ట్?** +Worst case లో, `n/m` jumps చేయాలి, ఇంకా చివరగా చెక్ చేసిన value వెతుకుతున్న element కంటే పెద్దదైతే, +linear search కోసం ఇంకో `m - 1` comparisons చేయాలి. కాబట్టి worst case లో మొత్తం comparisons +`((n/m) + m - 1)`. `m = √n` అయినప్పుడు `((n/m) + m - 1)` function value అతి తక్కువగా ఉంటుంది. +కాబట్టి, బెస్ట్ step సైజ్ `m = √n`. + +## Complexity + +**Time complexity**: `O(√n)` - ఎందుకంటే `√n` సైజ్ blocks తో search చేస్తాం. + +## References + +- [GeeksForGeeks](https://www.geeksforgeeks.org/jump-search/) +- [Wikipedia](https://en.wikipedia.org/wiki/Jump_search) diff --git a/src/algorithms/search/linear-search/README.md b/src/algorithms/search/linear-search/README.md index 8feb422eb2..e2652229be 100644 --- a/src/algorithms/search/linear-search/README.md +++ b/src/algorithms/search/linear-search/README.md @@ -1,7 +1,8 @@ # Linear Search _Read this in other languages:_ -[Português brasileiro](README.pt-BR.md). +[Português brasileiro](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md). In computer science, linear search or sequential search is a method for finding a target value within a list. It sequentially diff --git a/src/algorithms/search/linear-search/README.pt-BR.md b/src/algorithms/search/linear-search/README.pt-BR.md index e0af42f4ea..7017e0c78f 100644 --- a/src/algorithms/search/linear-search/README.pt-BR.md +++ b/src/algorithms/search/linear-search/README.pt-BR.md @@ -1,7 +1,8 @@ # Busca Linear _Leia isso em outras línguas:_ -[english](README.md). +[english](README.md), +[_తెలుగు_](README.tel-IN.md). Na Ciência da Computação, busca linear ou busca sequencial é um método para encontrar um elemento alvo em uma lista. O algoritmo verifica sequencialmente cada elemento da lista procurando o elemento alvo até ele ser encontrado ou até ter verificado todos os elementos. diff --git a/src/algorithms/search/linear-search/README.tel-IN.md b/src/algorithms/search/linear-search/README.tel-IN.md new file mode 100644 index 0000000000..07cd838d32 --- /dev/null +++ b/src/algorithms/search/linear-search/README.tel-IN.md @@ -0,0 +1,22 @@ +# Linear Search + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Português brasileiro_](README.pt-BR.md) + +Computer science లో linear search (లేదా sequential search) అనేది ఒక list లో target value +కనుక్కునే పద్ధతి. ఇది list లో ప్రతి element ని వరుసగా చెక్ చేస్తుంది — target దొరికేదాకా, లేదా +అన్ని elements చూసేదాకా. Linear search worst case లో linear time తీసుకుంటుంది, మహా అయితే `n` +comparisons చేస్తుంది — ఇక్కడ `n` అంటే list పొడవు. + +![Linear Search](https://www.tutorialspoint.com/data_structures_algorithms/images/linear_search.gif) + +## Complexity + +**Time Complexity**: `O(n)` - ఎందుకంటే worst case లో ప్రతి element ని సరిగ్గా ఒక్కసారి చెక్ +చేస్తాం. + +## References +- [Wikipedia](https://en.wikipedia.org/wiki/Linear_search) +- [TutorialsPoint](https://www.tutorialspoint.com/data_structures_algorithms/linear_search_algorithm.htm) +- [Youtube](https://www.youtube.com/watch?v=SGU9duLE30w) diff --git a/src/algorithms/sets/cartesian-product/README.md b/src/algorithms/sets/cartesian-product/README.md index ae58a15df1..1d96b586cf 100644 --- a/src/algorithms/sets/cartesian-product/README.md +++ b/src/algorithms/sets/cartesian-product/README.md @@ -1,5 +1,8 @@ # Cartesian Product +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + In set theory a Cartesian product is a mathematical operation that returns a set (or product set or simply product) from multiple sets. That is, for sets A and B, the Cartesian product A × B is the set of all ordered pairs (a, b) diff --git a/src/algorithms/sets/cartesian-product/README.tel-IN.md b/src/algorithms/sets/cartesian-product/README.tel-IN.md new file mode 100644 index 0000000000..f5399001c1 --- /dev/null +++ b/src/algorithms/sets/cartesian-product/README.tel-IN.md @@ -0,0 +1,16 @@ +# Cartesian Product + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Set theory లో Cartesian product అనేది చాలా sets నుంచి ఒక set (దీన్నే product set లేదా సింపుల్ గా +product అంటారు) ఇచ్చే ఒక mathematical operation. అంటే, A, B అనే sets కి, Cartesian product A × B +అంటే a ∈ A, b ∈ B అయ్యే అన్ని ordered pairs (a, b) ఉన్న set. + +`A={x,y,z}`, `B={1,2,3}` అనే రెండు sets యొక్క Cartesian product `AxB` + +![Cartesian Product of Two Sets](https://upload.wikimedia.org/wikipedia/commons/4/4e/Cartesian_Product_qtl1.svg) + +## References + +[Wikipedia](https://en.wikipedia.org/wiki/Cartesian_product) diff --git a/src/algorithms/sets/combination-sum/README.md b/src/algorithms/sets/combination-sum/README.md index cb14f1bae8..b28206c043 100644 --- a/src/algorithms/sets/combination-sum/README.md +++ b/src/algorithms/sets/combination-sum/README.md @@ -1,5 +1,8 @@ # Combination Sum Problem +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + Given a **set** of candidate numbers (`candidates`) **(without duplicates)** and a target number (`target`), find all unique combinations in `candidates` where the candidate numbers sums to `target`. diff --git a/src/algorithms/sets/combination-sum/README.tel-IN.md b/src/algorithms/sets/combination-sum/README.tel-IN.md new file mode 100644 index 0000000000..e74ff41004 --- /dev/null +++ b/src/algorithms/sets/combination-sum/README.tel-IN.md @@ -0,0 +1,62 @@ +# Combination Sum Problem + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Candidate numbers ఉన్న ఒక **set** (`candidates`) **(duplicates లేకుండా)**, ఇంకా ఒక target number +(`target`) ఇస్తే — `candidates` లో ఏ numbers కలిపితే `target` వస్తుందో, అలాంటి అన్ని unique +combinations కనుక్కోవాలి. + +`candidates` నుంచి **ఒకే** number ని ఎన్నిసార్లైనా ఎంచుకోవచ్చు. + +**Note:** + +- అన్ని numbers (`target` తో సహా) positive integers. +- Solution set లో ఒకే combination రెండుసార్లు ఉండకూడదు. + +## Examples + +``` +Input: candidates = [2,3,6,7], target = 7, + +A solution set is: +[ + [7], + [2,2,3] +] +``` + +``` +Input: candidates = [2,3,5], target = 8, + +A solution set is: +[ + [2,2,2,2], + [2,3,3], + [3,5] +] +``` + +## Explanations + +ఈ problem లో బెస్ట్ result గానీ, results సంఖ్య గానీ కాదు — possible అయిన అన్ని results కావాలి. +కాబట్టి DP (dynamic programming) గురించి ఆలోచించాల్సిన అవసరం లేదు, దీన్ని handle చేయడానికి +recursion వాడే backtracking approach కావాలి. + +`candidates = [2, 3]`, `target = 6` అయినప్పుడు decision tree example ఇది: + +``` + 0 + / \ + +2 +3 + / \ \ + +2 +3 +3 + / \ / \ \ + +2 ✘ ✘ ✘ ✓ + / \ + ✓ ✘ +``` + +## References + +- [LeetCode](https://leetcode.com/problems/combination-sum/description/) diff --git a/src/algorithms/sets/combinations/README.md b/src/algorithms/sets/combinations/README.md index 69fc0603f9..c6a0620790 100644 --- a/src/algorithms/sets/combinations/README.md +++ b/src/algorithms/sets/combinations/README.md @@ -1,5 +1,8 @@ # Combinations +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + When the order doesn't matter, it is a **Combination**. When the order **does** matter it is a **Permutation**. diff --git a/src/algorithms/sets/combinations/README.tel-IN.md b/src/algorithms/sets/combinations/README.tel-IN.md new file mode 100644 index 0000000000..1792b094c6 --- /dev/null +++ b/src/algorithms/sets/combinations/README.tel-IN.md @@ -0,0 +1,68 @@ +# Combinations + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Order (వరుస) ముఖ్యం కాకపోతే, అది **Combination**. + +Order **ముఖ్యం** అయితే, అది **Permutation**. + +**"నా fruit salad లో apples, grapes, bananas కలిపి ఉన్నాయి"** +Fruits ఏ order లో ఉన్నాయో మనం పట్టించుకోము — "bananas, grapes, apples" అయినా, +"grapes, apples, bananas" అయినా, అది అదే fruit salad. + +## Repetition లేని Combinations + +Lotteries ఇలాగే పనిచేస్తాయి. Numbers ని ఒక్కొక్కటిగా తీస్తారు, మన దగ్గర lucky numbers ఉంటే +(ఏ order లో అయినా సరే) మనం గెలుస్తాం! + +Repetition లేదు: lottery numbers లాగా `(2,14,15,27,30,33)` + +**Combinations సంఖ్య** + +![Formula](https://www.mathsisfun.com/combinatorics/images/combinations-no-repeat.png) + +ఇక్కడ `n` అంటే ఎంచుకోడానికి ఉన్న వస్తువుల సంఖ్య, అందులో `r` ఎంచుకుంటాం, +repetition లేదు, order ముఖ్యం కాదు. + +దీన్ని మామూలుగా "n choose r" అంటారు (ఉదాహరణకి "16 choose 3"). దీన్నే Binomial Coefficient అని కూడా అంటారు. + +## Repetition ఉన్న Combinations + +Repetition కుదురుతుంది: మీ జేబులో ఉన్న coins లాగా `(5,5,5,10,10)` + +లేదా ఐదు ice cream flavours ఉన్నాయి అనుకుందాం: +`banana`, `chocolate`, `lemon`, `strawberry`, `vanilla`. + +మనం మూడు scoops తీసుకోవచ్చు. ఎన్ని రకాలుగా తీసుకోవచ్చు? + +Flavours కి letters వాడదాం: `{b, c, l, s, v}`. +కొన్ని ఉదాహరణలు: + +- `{c, c, c}` (chocolate 3 scoops) +- `{b, l, v}` (banana, lemon, vanilla ఒక్కోటి) +- `{b, v, v}` (banana ఒకటి, vanilla రెండు) + +**Combinations సంఖ్య** + +![Formula](https://www.mathsisfun.com/combinatorics/images/combinations-repeat.gif) + +ఇక్కడ `n` అంటే ఎంచుకోడానికి ఉన్న వస్తువుల సంఖ్య, అందులో `r` ఎంచుకుంటాం. +Repetition కుదురుతుంది, order ముఖ్యం కాదు. + +## Cheatsheet + +![Permutations and Combinations Overview](./images/overview.png) + +![Combinations overview](./images/combinations-overview.jpg) + +| | | +| --- | --- | +|![Combinations with repetition](./images/combinations-with-repetitions.jpg) | ![Combinations without repetition](./images/combinations-without-repetitions.jpg) | + +*[okso.app](https://okso.app) తో తయారుచేశారు* + +## References + +- [Math Is Fun](https://www.mathsisfun.com/combinatorics/combinations-permutations.html) +- [Permutations/combinations cheat sheets](https://medium.com/@trekhleb/permutations-combinations-algorithms-cheat-sheet-68c14879aba5) diff --git a/src/algorithms/sets/fisher-yates/README.md b/src/algorithms/sets/fisher-yates/README.md index 36278d34e7..4979df71ad 100644 --- a/src/algorithms/sets/fisher-yates/README.md +++ b/src/algorithms/sets/fisher-yates/README.md @@ -1,5 +1,8 @@ # Fisher–Yates shuffle +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + The Fisher–Yates shuffle is an algorithm for generating a random permutation of a finite sequence—in plain terms, the algorithm shuffles the sequence. The algorithm effectively puts all the diff --git a/src/algorithms/sets/fisher-yates/README.tel-IN.md b/src/algorithms/sets/fisher-yates/README.tel-IN.md new file mode 100644 index 0000000000..d0050d2072 --- /dev/null +++ b/src/algorithms/sets/fisher-yates/README.tel-IN.md @@ -0,0 +1,16 @@ +# Fisher–Yates shuffle + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Fisher–Yates shuffle అనేది ఒక finite sequence కి random permutation తయారుచేసే algorithm — +సింపుల్ గా చెప్పాలంటే, ఈ algorithm sequence ని shuffle చేస్తుంది (కలిపేస్తుంది). ఈ algorithm +అన్ని elements ని ఒక టోపీలో వేసినట్టు చేస్తుంది; టోపీలో ఏమీ మిగలనంత వరకు, అందులో నుంచి random గా +ఒక element తీస్తూ next element ఏంటో నిర్ణయిస్తుంది. ఈ algorithm ఎలాంటి పక్షపాతం లేని (unbiased) +permutation ఇస్తుంది: ప్రతి permutation వచ్చే chance సమానం. ఈ algorithm modern version ఫాస్ట్ గా +ఉంటుంది: shuffle చేసే items సంఖ్యకి proportional టైమ్ తీసుకుంటుంది, ఇంకా వాటిని అక్కడికక్కడే +(in place) shuffle చేస్తుంది. + +## References + +[Wikipedia](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle) diff --git a/src/algorithms/sets/knapsack-problem/README.md b/src/algorithms/sets/knapsack-problem/README.md index 1d86019f62..f3b3b16de2 100644 --- a/src/algorithms/sets/knapsack-problem/README.md +++ b/src/algorithms/sets/knapsack-problem/README.md @@ -1,5 +1,8 @@ # Knapsack Problem +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + The knapsack problem or rucksack problem is a problem in combinatorial optimization: Given a set of items, each with a weight and a value, determine the number of each item to diff --git a/src/algorithms/sets/knapsack-problem/README.tel-IN.md b/src/algorithms/sets/knapsack-problem/README.tel-IN.md new file mode 100644 index 0000000000..74470c37b9 --- /dev/null +++ b/src/algorithms/sets/knapsack-problem/README.tel-IN.md @@ -0,0 +1,61 @@ +# Knapsack Problem + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Knapsack problem (లేదా rucksack problem) అనేది combinatorial optimization లో ఒక problem: +కొన్ని items ఇస్తారు, ప్రతి దానికి ఒక weight, ఒక value ఉంటాయి. ఒక collection లో ఏ item ఎన్ని +పెట్టాలో నిర్ణయించాలి — మొత్తం weight ఇచ్చిన limit కంటే తక్కువ లేదా సమానంగా ఉండాలి, ఇంకా +మొత్తం value వీలైనంత ఎక్కువగా ఉండాలి. + +ఈ పేరు ఎక్కడి నుంచి వచ్చిందంటే — ఒక fixed సైజ్ knapsack (బ్యాగ్) మాత్రమే ఉన్న ఒక వ్యక్తి, దాన్ని +అత్యంత విలువైన items తో నింపాలి అనే problem నుంచి. + +ఒక dimension (constraint) ఉన్న knapsack problem example: మొత్తం weight 15 kg కి మించకుండా, +డబ్బు వీలైనంత ఎక్కువ రావాలంటే ఏ boxes ఎంచుకోవాలి? + +![knapsack problem](https://upload.wikimedia.org/wikipedia/commons/f/fd/Knapsack.svg) + +## Definition + +### 0/1 knapsack problem + +ఎక్కువగా solve చేసే problem **0/1 knapsack problem** — ఇందులో ప్రతి రకం item copies సంఖ్య `xi` +zero గానీ one గానీ మాత్రమే అవ్వొచ్చు. + +`1` నుంచి `n` వరకు నంబర్లు ఉన్న n items ఇస్తారు, ప్రతి దానికి weight `wi`, value `vi` ఉంటాయి, +ఇంకా maximum weight capacity `W` ఇస్తారు, + +దీన్ని maximize చేయాలి ![0/1 knapsack](https://wikimedia.org/api/rest_v1/media/math/render/svg/85620037d368d2136fb3361702df6a489416931b) + +ఈ conditions తో ![0/1 knapsack](https://wikimedia.org/api/rest_v1/media/math/render/svg/dd6e7c9bca4397980976ea6d19237500ce3b8176) +ఇంకా ![0/1 knapsack](https://wikimedia.org/api/rest_v1/media/math/render/svg/07dda71da2a630762c7b21b51ea54f86f422f951) + +ఇక్కడ `xi` అంటే knapsack లో item `i` ఎన్ని పెట్టాలి అని. సింపుల్ గా చెప్పాలంటే — knapsack లో +ఉన్న items weights మొత్తం knapsack capacity కి మించకుండా, items values మొత్తం వీలైనంత ఎక్కువ +చేయాలి. + +### Bounded knapsack problem (BKP) + +**Bounded knapsack problem (BKP)** లో ప్రతి item ఒక్కటే ఉండాలి అనే condition ఉండదు, కానీ ప్రతి రకం +item copies సంఖ్య `xi` ఒక maximum non-negative integer value `c` కి మించకూడదు: + +దీన్ని maximize చేయాలి ![bounded knapsack](https://wikimedia.org/api/rest_v1/media/math/render/svg/85620037d368d2136fb3361702df6a489416931b) + +ఈ conditions తో ![bounded knapsack](https://wikimedia.org/api/rest_v1/media/math/render/svg/dd6e7c9bca4397980976ea6d19237500ce3b8176) +ఇంకా ![bounded knapsack](https://wikimedia.org/api/rest_v1/media/math/render/svg/6c8c5ac4f8247b3b8e01e89de76a1df0ea969821) + +### Unbounded knapsack problem (UKP) + +**Unbounded knapsack problem (UKP)** లో ప్రతి రకం item copies సంఖ్య మీద పై limit ఏమీ ఉండదు. దీన్ని +పైన లాగానే రాయొచ్చు, కాకపోతే `xi` మీద ఉన్న ఒకే condition — అది non-negative integer అయి ఉండాలి. + +దీన్ని maximize చేయాలి ![unbounded knapsack](https://wikimedia.org/api/rest_v1/media/math/render/svg/85620037d368d2136fb3361702df6a489416931b) + +ఈ conditions తో ![unbounded knapsack](https://wikimedia.org/api/rest_v1/media/math/render/svg/dd6e7c9bca4397980976ea6d19237500ce3b8176) +ఇంకా ![unbounded knapsack](https://wikimedia.org/api/rest_v1/media/math/render/svg/90a99710f61d5dea19e49ae5b31164d2b56b07e3) + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Knapsack_problem) +- [YouTube లో 0/1 Knapsack Problem](https://www.youtube.com/watch?v=8LusJS5-AGo&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/sets/longest-common-subsequence/README.md b/src/algorithms/sets/longest-common-subsequence/README.md index 7c9328e073..5c545a2e26 100644 --- a/src/algorithms/sets/longest-common-subsequence/README.md +++ b/src/algorithms/sets/longest-common-subsequence/README.md @@ -1,5 +1,8 @@ # Longest common subsequence problem +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + The longest common subsequence (LCS) problem is the problem of finding the longest subsequence common to all sequences in a set of sequences (often just two sequences). It differs from the longest common substring diff --git a/src/algorithms/sets/longest-common-subsequence/README.tel-IN.md b/src/algorithms/sets/longest-common-subsequence/README.tel-IN.md new file mode 100644 index 0000000000..f03d7e0b5d --- /dev/null +++ b/src/algorithms/sets/longest-common-subsequence/README.tel-IN.md @@ -0,0 +1,25 @@ +# Longest common subsequence problem + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Longest common subsequence (LCS) problem అంటే — కొన్ని sequences (మామూలుగా రెండు sequences) ఉన్న +set లో, అన్ని sequences లోనూ common గా ఉన్న అతి పొడవైన subsequence కనుక్కోవడం. ఇది longest common +substring problem కంటే వేరు: substrings లాగా కాకుండా, subsequences original sequences లో వరుసగా +పక్కపక్కనే ఉండాల్సిన అవసరం లేదు. + +## ఎక్కడ వాడతారు + +Longest common subsequence problem అనేది ఒక classic computer science problem. diff utility లాంటి +data compare చేసే programs కి ఇదే బేస్, ఇంకా bioinformatics లో కూడా వాడతారు. Git లాంటి revision +control systems కూడా దీన్ని బాగా వాడతాయి — files collection లో చేసిన చాలా మార్పులని కలపడానికి. + +## Example + +- `ABCDGH`, `AEDFHR` అనే input sequences కి LCS `ADH`, దాని పొడవు 3. +- `AGGTAB`, `GXTXAYB` అనే input sequences కి LCS `GTAB`, దాని పొడవు 4. + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Longest_common_subsequence_problem) +- [YouTube](https://www.youtube.com/watch?v=NnD96abizww&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/sets/longest-increasing-subsequence/README.md b/src/algorithms/sets/longest-increasing-subsequence/README.md index bcb2665c2d..33e3d7688c 100644 --- a/src/algorithms/sets/longest-increasing-subsequence/README.md +++ b/src/algorithms/sets/longest-increasing-subsequence/README.md @@ -1,5 +1,8 @@ # Longest Increasing Subsequence +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + The longest increasing subsequence problem is to find a subsequence of a given sequence in which the subsequence's elements are in sorted order, lowest to highest, and in which the subsequence is as long as possible. diff --git a/src/algorithms/sets/longest-increasing-subsequence/README.tel-IN.md b/src/algorithms/sets/longest-increasing-subsequence/README.tel-IN.md new file mode 100644 index 0000000000..782c249cec --- /dev/null +++ b/src/algorithms/sets/longest-increasing-subsequence/README.tel-IN.md @@ -0,0 +1,45 @@ +# Longest Increasing Subsequence + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Longest increasing subsequence problem అంటే — ఇచ్చిన sequence లో ఒక subsequence కనుక్కోవాలి, +అందులో elements చిన్న నుంచి పెద్ద వరకు sort అయిన order లో ఉండాలి, ఇంకా ఆ subsequence వీలైనంత +పొడవుగా ఉండాలి. ఈ subsequence వరుసగా పక్కపక్కనే ఉండాల్సిన అవసరం లేదు, ఒక్కటే ఉండాల్సిన అవసరం కూడా లేదు. + +## Complexity + +Longest increasing subsequence problem ని `O(n log n)` టైమ్ లో solve చేయొచ్చు, ఇక్కడ `n` అంటే +input sequence పొడవు. + +Dynamic programming approach complexity `O(n * n)`. + +## Example + +Binary Van der Corput sequence లో మొదటి 16 terms + +``` +0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15 +``` + +లో ఒక longest increasing subsequence ఇది + +``` +0, 2, 6, 9, 11, 15. +``` + +ఈ subsequence పొడవు ఆరు; input sequence లో ఏడు elements ఉన్న increasing subsequence ఏదీ లేదు. +ఈ example లో longest increasing subsequence ఒక్కటే కాదు: ఉదాహరణకి, + +``` +0, 4, 6, 9, 11, 15 or +0, 2, 6, 9, 13, 15 or +0, 4, 6, 9, 13, 15 +``` + +ఇవి కూడా అదే input sequence లో అంతే పొడవు ఉన్న increasing subsequences. + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Longest_increasing_subsequence) +- [YouTube లో Dynamic Programming Approach](https://www.youtube.com/watch?v=CE2b_-XfVDk&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/sets/maximum-subarray/README.md b/src/algorithms/sets/maximum-subarray/README.md index f06300f500..bd48d8e649 100644 --- a/src/algorithms/sets/maximum-subarray/README.md +++ b/src/algorithms/sets/maximum-subarray/README.md @@ -1,5 +1,8 @@ # Maximum subarray problem +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + The maximum subarray problem is the task of finding the contiguous subarray within a one-dimensional array, `a[1...n]`, of numbers which has the largest sum, where, diff --git a/src/algorithms/sets/maximum-subarray/README.tel-IN.md b/src/algorithms/sets/maximum-subarray/README.tel-IN.md new file mode 100644 index 0000000000..0fac369c44 --- /dev/null +++ b/src/algorithms/sets/maximum-subarray/README.tel-IN.md @@ -0,0 +1,30 @@ +# Maximum subarray problem + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Maximum subarray problem అంటే — numbers ఉన్న ఒక dimension array `a[1...n]` లో, అతి పెద్ద మొత్తం +(sum) వచ్చే, వరుసగా పక్కపక్కనే ఉన్న (contiguous) subarray కనుక్కోవడం, ఇక్కడ, + +![Maximum subarray](https://wikimedia.org/api/rest_v1/media/math/render/svg/e8960f093107b71b21827e726e2bad8b023779b2) + +![Maximum subarray](https://www.geeksforgeeks.org/wp-content/uploads/kadane-Algorithm.png) + +## Example + +List లో మామూలుగా positive, negative numbers తో పాటు `0` కూడా ఉంటుంది. ఉదాహరణకి, +`−2, 1, −3, 4, −1, 2, 1, −5, 4` values ఉన్న array లో అతి పెద్ద మొత్తం ఉన్న contiguous subarray +`4, −1, 2, 1`, దాని మొత్తం `6`. + +## Solutions + +- Brute Force solution `O(n^2)`: [bfMaximumSubarray.js](./bfMaximumSubarray.js) +- Divide and Conquer solution `O(n^2)`: [dcMaximumSubarraySum.js](./dcMaximumSubarraySum.js) +- Dynamic Programming solution `O(n)`: [dpMaximumSubarray.js](./dpMaximumSubarray.js) + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Maximum_subarray_problem) +- [YouTube](https://www.youtube.com/watch?v=ohHWQf1HDfU&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) +- [GeeksForGeeks](https://www.geeksforgeeks.org/largest-sum-contiguous-subarray/) +- [LeetCode](https://leetcode.com/explore/interview/card/top-interview-questions-easy/97/dynamic-programming/566/discuss/1595195/C++Python-7-Simple-Solutions-w-Explanation-or-Brute-Force-+-DP-+-Kadane-+-Divide-and-Conquer) diff --git a/src/algorithms/sets/permutations/README.md b/src/algorithms/sets/permutations/README.md index 08a0a05823..e90b3701e6 100644 --- a/src/algorithms/sets/permutations/README.md +++ b/src/algorithms/sets/permutations/README.md @@ -1,5 +1,8 @@ # Permutations +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + When the order doesn't matter, it is a **Combination**. When the order **does** matter it is a **Permutation**. diff --git a/src/algorithms/sets/permutations/README.tel-IN.md b/src/algorithms/sets/permutations/README.tel-IN.md new file mode 100644 index 0000000000..0553a9cd3e --- /dev/null +++ b/src/algorithms/sets/permutations/README.tel-IN.md @@ -0,0 +1,58 @@ +# Permutations + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Order (వరుస) ముఖ్యం కాకపోతే, అది **Combination**. + +Order **ముఖ్యం** అయితే, అది **Permutation**. + +**"Safe (తిజోరీ) తెరవడానికి combination 472"**. ఇక్కడ order మనకి ముఖ్యం. `724` పనిచేయదు, `247` కూడా పనిచేయదు. +అది సరిగ్గా `4-7-2` నే అయి ఉండాలి. + +## Repetition లేని Permutations + +Permutation ("arrangement number" లేదా "order" అని కూడా అంటారు) అంటే ఒక ordered list `S` లో +elements ని మళ్ళీ వేరే వరుసలో పెట్టడం — `S` తోనే ఒకదానికొకటి (one-to-one) సరిపోయేలా. + +String `ABC` యొక్క permutations ఇవి. + +`ABC ACB BAC BCA CBA CAB` + +లేదా ఉదాహరణకి running race లో మొదటి ముగ్గురు: మీరు first, second రెండూ అవ్వలేరు కదా. + +**Combinations సంఖ్య** + +``` +n * (n-1) * (n -2) * ... * 1 = n! +``` + +## Repetition ఉన్న Permutations + +Repetition కుదిరితే, అవి repetition ఉన్న permutations. +ఉదాహరణకి, కింద ఉన్న lock నంబర్ `333` కూడా కావొచ్చు. + +![Permutation Lock](https://www.mathsisfun.com/combinatorics/images/permutation-lock.jpg) + +**Combinations సంఖ్య** + +``` +n * n * n ... (r times) = n^r +``` + +## Cheatsheet + +![Permutations and Combinations Overview](./images/overview.png) + +![Permutations overview](./images/permutations-overview.jpeg) + +| | | +| --- | --- | +|![Permutations with repetition](./images/permutations-with-repetitions.jpg) | ![Permutations without repetition](./images/permutations-without-repetitions.jpg) | + +*[okso.app](https://okso.app) తో తయారుచేశారు* + +## References + +- [Math Is Fun](https://www.mathsisfun.com/combinatorics/combinations-permutations.html) +- [Permutations/combinations cheat sheets](https://medium.com/@trekhleb/permutations-combinations-algorithms-cheat-sheet-68c14879aba5) diff --git a/src/algorithms/sets/power-set/README.md b/src/algorithms/sets/power-set/README.md index e96961dd8f..1e74b2de4f 100644 --- a/src/algorithms/sets/power-set/README.md +++ b/src/algorithms/sets/power-set/README.md @@ -1,5 +1,8 @@ # Power Set +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + Power set of a set `S` is the set of all of the subsets of `S`, including the empty set and `S` itself. Power set of set `S` is denoted as `P(S)`. diff --git a/src/algorithms/sets/power-set/README.tel-IN.md b/src/algorithms/sets/power-set/README.tel-IN.md new file mode 100644 index 0000000000..e73935a196 --- /dev/null +++ b/src/algorithms/sets/power-set/README.tel-IN.md @@ -0,0 +1,110 @@ +# Power Set + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +ఒక set `S` యొక్క Power set అంటే `S` యొక్క అన్ని subsets ఉన్న set — empty set, `S` తో సహా. +Set `S` యొక్క power set ని `P(S)` అని రాస్తారు. + +ఉదాహరణకి `{x, y, z}` కి subsets ఇవి: + +```text +{ + {}, // (also denoted empty set ∅ or the null set) + {x}, + {y}, + {z}, + {x, y}, + {x, z}, + {y, z}, + {x, y, z} +} +``` + +![Power Set](https://www.mathsisfun.com/sets/images/power-set.svg) + +Set `{x, y, z}` యొక్క power set elements ని, ఒకదాంట్లో ఒకటి ఉండటం (inclusion) ని బట్టి వరుసలో +పెడితే ఇలా చూపించొచ్చు: + +![](https://upload.wikimedia.org/wikipedia/commons/e/ea/Hasse_diagram_of_powerset_of_3.svg) + +**Subsets సంఖ్య** + +`S` అనేది `|S| = n` elements ఉన్న finite set అయితే, `S` యొక్క subsets సంఖ్య `|P(S)| = 2^n`. +`2^S` notation కి ఇదే కారణం — దీన్ని సింపుల్ గా ఇలా చూపించొచ్చు: + +> ముందు `S` లో elements ని ఏదో ఒక వరుసలో పెట్టండి. `S` యొక్క ఏ subset నైనా `{γ1, γ2, ..., γn}` +format లో రాస్తాం, ఇక్కడ `γi , 1 ≤ i ≤ n` కి `0` గానీ `1` గానీ value ఉండొచ్చు. `γi = 1` అయితే, +`S` లో `i`-th element ఆ subset లో ఉంది; లేకపోతే, `i`-th element subset లో లేదు. `γi ∈ {0, 1}` +కాబట్టి, ఇలా తయారుచేయగలిగే వేరువేరు subsets సంఖ్య `2^n` అని క్లియర్ గా తెలుస్తుంది. + +## Algorithms + +### Bitwise Solution + +`0` నుంచి `2^n` range లో ఉన్న ప్రతి నంబర్ binary representation మనకి కావాల్సిందే చేస్తుంది: దాని +bits (`0` లేదా `1`) తో set లో సంబంధిత element ని కలపాలా వద్దా అని చెప్తుంది. ఉదాహరణకి, set +`{1, 2, 3}` కి binary నంబర్ `0b010` అంటే ఇప్పటి set లో `2` మాత్రమే కలపాలి అని. + +| | `abc` | Subset | +| :---: | :---: | :-----------: | +| `0` | `000` | `{}` | +| `1` | `001` | `{c}` | +| `2` | `010` | `{b}` | +| `3` | `011` | `{c, b}` | +| `4` | `100` | `{a}` | +| `5` | `101` | `{a, c}` | +| `6` | `110` | `{a, b}` | +| `7` | `111` | `{a, b, c}` | + +> Bitwise solution కోసం [bwPowerSet.js](./bwPowerSet.js) file చూడండి. + +### Backtracking Solution + +Backtracking approach లో set లో next element ని subset లో కలపడానికి నిరంతరం ట్రై చేస్తాం, దాన్ని +గుర్తుపెట్టుకుని, తర్వాత తీసేసి, next element తో కూడా అలాగే ట్రై చేస్తాం. + +> Backtracking solution కోసం [btPowerSet.js](./btPowerSet.js) file చూడండి. + +### Cascading Solution + +Power Set తయారుచేయడానికి బహుశా ఇదే అన్నిటికంటే సింపుల్ solution. + +ఒక empty set తో మొదలుపెడతాం: + +```text +powerSets = [[]] +``` + +ఇప్పుడు, ఇలా అనుకుందాం: + +```text +originalSet = [1, 2, 3] +``` + +originalSet లో 1st element ని ఇప్పటికే ఉన్న అన్ని sets కి కలుపుదాం: + +```text +[[]] ← 1 = [[], [1]] +``` + +2nd element ని ఇప్పటికే ఉన్న అన్ని sets కి కలుపుతున్నాం: + +```text +[[], [1]] ← 2 = [[], [1], [2], [1, 2]] +``` + +3rd element ని ఇప్పటికే ఉన్న అన్ని sets కి కలుపుతున్నాం: + +``` +[[], [1], [2], [1, 2]] ← 3 = [[], [1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3]] +``` + +`originalSet` లో మిగతా elements కి కూడా ఇలాగే. ప్రతి iteration లో sets సంఖ్య రెట్టింపు అవుతుంది, కాబట్టి `2^n` sets వస్తాయి. + +> Cascading solution కోసం [caPowerSet.js](./caPowerSet.js) file చూడండి. + +## References + +* [Wikipedia](https://en.wikipedia.org/wiki/Power_set) +* [Math is Fun](https://www.mathsisfun.com/sets/power-set.html) diff --git a/src/algorithms/sets/shortest-common-supersequence/README.md b/src/algorithms/sets/shortest-common-supersequence/README.md index 5af90a8337..b70dd4de7d 100644 --- a/src/algorithms/sets/shortest-common-supersequence/README.md +++ b/src/algorithms/sets/shortest-common-supersequence/README.md @@ -1,5 +1,8 @@ # Shortest Common Supersequence +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + The shortest common supersequence (SCS) of two sequences `X` and `Y` is the shortest sequence which has `X` and `Y` as subsequences. diff --git a/src/algorithms/sets/shortest-common-supersequence/README.tel-IN.md b/src/algorithms/sets/shortest-common-supersequence/README.tel-IN.md new file mode 100644 index 0000000000..4d5da428f8 --- /dev/null +++ b/src/algorithms/sets/shortest-common-supersequence/README.tel-IN.md @@ -0,0 +1,26 @@ +# Shortest Common Supersequence + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +`X`, `Y` అనే రెండు sequences యొక్క shortest common supersequence (SCS) అంటే — `X`, `Y` రెండూ +subsequences గా ఉండే అతి చిన్న sequence. + +ఇంకోలా చెప్పాలంటే, str1, str2 అనే రెండు strings ఇస్తే — str1, str2 రెండూ subsequences గా ఉండే +అతి చిన్న string కనుక్కోవాలి. + +ఈ problem కి longest common subsequence problem కి దగ్గరి సంబంధం ఉంది. + +## Example + +``` +Input: str1 = "geek", str2 = "eke" +Output: "geeke" + +Input: str1 = "AGGTAB", str2 = "GXTXAYB" +Output: "AGXGTXAYB" +``` + +## References + +- [GeeksForGeeks](https://www.geeksforgeeks.org/shortest-common-supersequence/) diff --git a/src/algorithms/sorting/bubble-sort/README.md b/src/algorithms/sorting/bubble-sort/README.md index 66347d86c7..17f6b32426 100644 --- a/src/algorithms/sorting/bubble-sort/README.md +++ b/src/algorithms/sorting/bubble-sort/README.md @@ -1,7 +1,8 @@ # Bubble Sort _Read this in other languages:_ -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through diff --git a/src/algorithms/sorting/bubble-sort/README.pt-BR.md b/src/algorithms/sorting/bubble-sort/README.pt-BR.md index e650523d71..70c4623f01 100644 --- a/src/algorithms/sorting/bubble-sort/README.pt-BR.md +++ b/src/algorithms/sorting/bubble-sort/README.pt-BR.md @@ -1,7 +1,8 @@ # Bubble Sort _Leia isso em outros idiomas:_ -[_English_](README.md) +[_English_](README.md), +[_తెలుగు_](README.tel-IN.md) O bubble sort, ou ordenação por flutuação (literalmente "por bolha"), é um algoritmo de ordenação dos mais simples. A ideia é percorrer o vetor diversas vezes, e a cada passagem fazer flutuar para o topo o maior elemento da sequência. Essa movimentação lembra a forma como as bolhas em um tanque de água procuram seu próprio nível, e disso vem o nome do algoritmo. diff --git a/src/algorithms/sorting/bubble-sort/README.tel-IN.md b/src/algorithms/sorting/bubble-sort/README.tel-IN.md new file mode 100644 index 0000000000..b380600428 --- /dev/null +++ b/src/algorithms/sorting/bubble-sort/README.tel-IN.md @@ -0,0 +1,24 @@ +# Bubble Sort + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Português_](README.pt-BR.md) + +Bubble sort (దీన్ని కొన్నిసార్లు sinking sort అని కూడా అంటారు) అనేది ఒక సింపుల్ sorting +algorithm. ఇది sort చేయాల్సిన list మీద మళ్ళీ మళ్ళీ వెళ్తూ, పక్కపక్కన ఉన్న ప్రతి జత items ని +compare చేసి, అవి తప్పు order లో (ascending లేదా descending వరుసలో) ఉంటే వాటిని మార్చేస్తుంది +(swap చేస్తుంది). ఒక్క swap కూడా అవసరం లేనంత వరకు list మీద ఇలా వెళ్తూనే ఉంటుంది — swaps +అవసరం లేదంటే list sort అయిపోయింది అని అర్థం. + +![Algorithm Visualization](https://upload.wikimedia.org/wikipedia/commons/c/c8/Bubble-sort-example-300px.gif) + +## Complexity + +| పేరు | Best | Average | Worst | Memory | Stable | Comments | +| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- | +| **Bubble sort** | n | n2 | n2 | 1 | అవును | | + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Bubble_sort) +- [YouTube](https://www.youtube.com/watch?v=6Gv8vg0kcHc&index=27&t=0s&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/sorting/bucket-sort/README.md b/src/algorithms/sorting/bucket-sort/README.md index 673ba80b71..fee41cab9d 100644 --- a/src/algorithms/sorting/bucket-sort/README.md +++ b/src/algorithms/sorting/bucket-sort/README.md @@ -1,5 +1,8 @@ # Bucket Sort +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + **Bucket sort**, or **bin sort**, is a sorting algorithm that works by distributing the elements of an array into a number of buckets. Each bucket is then sorted individually, either using a different sorting algorithm, or by recursively applying the bucket sorting algorithm. ## Algorithm diff --git a/src/algorithms/sorting/bucket-sort/README.tel-IN.md b/src/algorithms/sorting/bucket-sort/README.tel-IN.md new file mode 100644 index 0000000000..eb30d99b7c --- /dev/null +++ b/src/algorithms/sorting/bucket-sort/README.tel-IN.md @@ -0,0 +1,37 @@ +# Bucket Sort + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +**Bucket sort** (లేదా **bin sort**) అనేది ఒక array లో elements ని కొన్ని buckets (బకెట్లు) లోకి పంచి పనిచేసే sorting algorithm. తర్వాత ప్రతి bucket ని విడిగా sort చేస్తారు — వేరే sorting algorithm తో గానీ, లేదా bucket sorting algorithm నే మళ్ళీ recursive గా వాడి గానీ. + +## Algorithm + +Bucket sort ఇలా పనిచేస్తుంది: + +1. మొదట్లో ఖాళీగా ఉన్న `buckets` array ఒకటి తయారుచేయండి. +2. **Scatter (పంచడం):** Original array మీద వెళ్తూ, ప్రతి object ని దాని `bucket` లో పెట్టండి. +3. ఖాళీగా లేని ప్రతి `bucket` ని sort చేయండి. +4. **Gather (పోగుచేయడం):** `buckets` ని వరుసగా visit చేసి, అన్ని elements ని మళ్ళీ original array లో పెట్టండి. + +Elements ని bins లోకి పంచుతారు: + +![Elements are distributed among bins](./images/bucket_sort_1.png) + +తర్వాత, ప్రతి bin లోపల elements ని sort చేస్తారు: + +![Elements are sorted within each bin](./images/bucket_sort_2.png) + + +## Complexity + +Computational complexity మూడు విషయాల మీద ఆధారపడి ఉంటుంది — ప్రతి bucket ని sort చేయడానికి వాడే algorithm, ఎన్ని buckets వాడతాం, ఇంకా input సమానంగా పంచబడి (uniformly distributed) ఉందా లేదా. + +Bucket మీద వాడే sorting algorithm *insertion sort* అయితే, bucket sort **worst-case** time complexity +`O(n^2)`. ఎక్కువగా అదే వాడతారు, ఎందుకంటే మొత్తం list తో పోలిస్తే buckets లో మరీ ఎక్కువ elements ఉండవు అని అనుకుంటాం. Worst case లో అన్ని elements ఒకే bucket లో పడతాయి, అప్పుడు running time insertion sort worst-case complexity కి (అన్ని elements తిరగబడిన order లో ఉన్నప్పుడు) పడిపోతుంది. మధ్యలో వాడే sort యొక్క worst-case running time `O(n * log(n))` అయితే, bucket sort worst-case running time కూడా `O(n * log(n))` అవుతుంది. + +**Average** గా, buckets లోకి elements దాదాపు సమానంగా పంచబడితే, `k` buckets కి bucket sort average గా `O(n + k)` లో రన్ అవుతుంది అని చూపించొచ్చు. + +## References + +- [Wikipedia లో Bucket Sort](https://en.wikipedia.org/wiki/Bucket_sort) diff --git a/src/algorithms/sorting/counting-sort/README.md b/src/algorithms/sorting/counting-sort/README.md index 40a9539a22..e221013443 100644 --- a/src/algorithms/sorting/counting-sort/README.md +++ b/src/algorithms/sorting/counting-sort/README.md @@ -1,7 +1,8 @@ # Counting Sort _Read this in other languages:_ -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) In computer science, **counting sort** is an algorithm for sorting a collection of objects according to keys that are small integers; diff --git a/src/algorithms/sorting/counting-sort/README.pt-br.md b/src/algorithms/sorting/counting-sort/README.pt-br.md index af2c75f6af..0feafc8793 100644 --- a/src/algorithms/sorting/counting-sort/README.pt-br.md +++ b/src/algorithms/sorting/counting-sort/README.pt-br.md @@ -1,7 +1,8 @@ # Counting Sort _Leia isso em outros idiomas:_ -[_English_](README.md) +[_English_](README.md), +[_తెలుగు_](README.tel-IN.md) Em ciência da computação, **counting sort** é um algoritmo para ordenar uma coleção de objetos de acordo com chaves que são pequenos inteiros; diff --git a/src/algorithms/sorting/counting-sort/README.tel-IN.md b/src/algorithms/sorting/counting-sort/README.tel-IN.md new file mode 100644 index 0000000000..f52c0e615c --- /dev/null +++ b/src/algorithms/sorting/counting-sort/README.tel-IN.md @@ -0,0 +1,58 @@ +# Counting Sort + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Português_](README.pt-br.md) + +Computer science లో **counting sort** అనేది చిన్న integers గా ఉండే keys ని బట్టి objects collection +ని sort చేసే algorithm; అంటే ఇది ఒక integer sorting algorithm. ప్రతి వేరువేరు key value ఉన్న objects +ఎన్ని ఉన్నాయో లెక్కపెట్టి, ఆ లెక్కల మీద arithmetic చేసి output sequence లో ప్రతి key value ఏ position +లో రావాలో నిర్ణయిస్తుంది. దీని running time, items సంఖ్య మీద, ఇంకా maximum, minimum key values మధ్య +తేడా మీద linear గా ఉంటుంది. కాబట్టి keys లో తేడా items సంఖ్య కంటే మరీ ఎక్కువ లేనప్పుడు మాత్రమే +దీన్ని డైరెక్ట్ గా వాడటం కరెక్ట్. కానీ పెద్ద keys ని ఇంకా బాగా handle చేయగలిగే radix sort అనే ఇంకో +sorting algorithm లో దీన్ని ఒక subroutine గా ఎక్కువగా వాడతారు. + +Counting sort key values ని array లో indexes గా వాడుతుంది కాబట్టి, ఇది comparison sort కాదు — +comparison sorting కి ఉండే `Ω(n log n)` lower bound దీనికి వర్తించదు. Counting sort చేసే చాలా పనులకి +bucket sort కూడా వాడొచ్చు, time analysis కూడా దాదాపు ఒకేలా ఉంటుంది; కానీ counting sort తో పోలిస్తే, +bucket sort కి ప్రతి bucket లో items sets ని ఉంచడానికి linked lists, dynamic arrays లేదా ముందే +కేటాయించిన చాలా memory కావాలి. Counting sort మాత్రం ప్రతి bucket కి ఒకే ఒక్క నంబర్ (items లెక్క) +store చేస్తుంది. + +ప్రతి array element నంబర్ల range చాలా చిన్నగా ఉన్నప్పుడు counting sort బాగా పనిచేస్తుంది. + +## Algorithm + +**Step I** + +మొదటి step లో input array `A` లో ఉన్న అన్ని elements లెక్క (count) తీస్తాం. తర్వాత ఆ result ని +count array `C` లో store చేస్తాం. ఎలా లెక్కపెడతామో కింద చూపించారు. + +![Counting Sort](https://3.bp.blogspot.com/-jJchly1BkTc/WLGqCFDdvCI/AAAAAAAAAHA/luljAlz2ptMndIZNH0KLTTuQMNsfzDeFQCLcB/s1600/CSortUpdatedStepI.gif) + +**Step II** + +రెండో step లో, input array `A` లో ఇచ్చిన index కంటే తక్కువ లేదా సమానంగా ఉన్న elements ఎన్ని +ఉన్నాయో లెక్కపెడతాం. `Ci` = input array లో `i` కంటే తక్కువ లేదా సమానంగా ఉన్న elements సంఖ్య. + +![Counting Sort](https://1.bp.blogspot.com/-1vFu-VIRa9Y/WLHGuZkdF3I/AAAAAAAAAHs/8jKu2dbQee4ap9xlVcNsILrclqw0UxAVACLcB/s1600/Step-II.png) + +**Step III** + +ఈ step లో, రెండో step లో తయారుచేసిన count array `C` సాయంతో input array `A` elements ని sort అయిన +position లో పెడతాం. Sort అయిన elements ని store చేయడానికి result array `B` వాడాం. ఇక్కడ `B` index +ని zero నుంచి మొదలుపెట్టాం. + +![Counting Sort](https://1.bp.blogspot.com/-xPqylngqASY/WLGq3p9n9vI/AAAAAAAAAHM/JHdtXAkJY8wYzDMBXxqarjmhpPhM0u8MACLcB/s1600/ResultArrayCS.gif) + +## Complexity + +| పేరు | Best | Average | Worst | Memory | Stable | Comments | +| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- | +| **Counting sort** | n + r | n + r | n + r | n + r | అవును | r - array లో ఉన్న అతి పెద్ద నంబర్ | + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Counting_sort) +- [YouTube](https://www.youtube.com/watch?v=OKd534EWcdk&index=61&t=0s&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) +- [EfficientAlgorithms](https://efficientalgorithms.blogspot.com/2016/09/lenear-sorting-counting-sort.html) diff --git a/src/algorithms/sorting/heap-sort/README.md b/src/algorithms/sorting/heap-sort/README.md index 2370776f1b..f82559f104 100644 --- a/src/algorithms/sorting/heap-sort/README.md +++ b/src/algorithms/sorting/heap-sort/README.md @@ -1,7 +1,8 @@ # Heap Sort _Read this in other languages:_ -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) Heapsort is a comparison-based sorting algorithm. Heapsort can be thought of as an improved selection diff --git a/src/algorithms/sorting/heap-sort/README.pt-BR.md b/src/algorithms/sorting/heap-sort/README.pt-BR.md index 6d5a2d4849..60d21f6be9 100644 --- a/src/algorithms/sorting/heap-sort/README.pt-BR.md +++ b/src/algorithms/sorting/heap-sort/README.pt-BR.md @@ -1,7 +1,8 @@ # Heap Sort _Leia isso em outros idiomas:_ -[_English_](README.md) +[_English_](README.md), +[_తెలుగు_](README.tel-IN.md) Heapsort é um algoritmo de ordenação baseado em comparação. O Heapsort pode ser pensado como uma seleção aprimorada sort: como esse algoritmo, ele divide sua entrada em uma região classificada e uma região não classificada, e iterativamente encolhe a região não classificada extraindo o maior elemento e movendo-o para a região classificada. A melhoria consiste no uso de uma estrutura de dados heap em vez de uma busca em tempo linear para encontrar o máximo. diff --git a/src/algorithms/sorting/heap-sort/README.tel-IN.md b/src/algorithms/sorting/heap-sort/README.tel-IN.md new file mode 100644 index 0000000000..72cf5fa599 --- /dev/null +++ b/src/algorithms/sorting/heap-sort/README.tel-IN.md @@ -0,0 +1,25 @@ +# Heap Sort + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Português_](README.pt-BR.md) + +Heapsort అనేది comparison మీద బేస్ అయిన sorting algorithm. +Heapsort ని selection sort కి మెరుగైన version గా అనుకోవచ్చు: ఆ algorithm లాగానే ఇది కూడా input ని +sort అయిన భాగం, sort కాని భాగం గా విడగొడుతుంది. ప్రతిసారి sort కాని భాగం నుంచి అతి పెద్ద element ని +తీసి sort అయిన భాగానికి జరుపుతూ, sort కాని భాగాన్ని చిన్నది చేస్తూ వెళ్తుంది. మెరుగు ఎక్కడంటే — +maximum కనుక్కోవడానికి linear-time search బదులు heap data structure వాడుతుంది. + +![Algorithm Visualization](https://upload.wikimedia.org/wikipedia/commons/1/1b/Sorting_heapsort_anim.gif) + +![Algorithm Visualization](https://upload.wikimedia.org/wikipedia/commons/4/4d/Heapsort-example.gif) + +## Complexity + +| పేరు | Best | Average | Worst | Memory | Stable | Comments | +| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- | +| **Heap sort** | n log(n) | n log(n) | n log(n) | 1 | కాదు | | + +## References + +[Wikipedia](https://en.wikipedia.org/wiki/Heapsort) diff --git a/src/algorithms/sorting/insertion-sort/README.md b/src/algorithms/sorting/insertion-sort/README.md index 8bc922683f..f25691e183 100644 --- a/src/algorithms/sorting/insertion-sort/README.md +++ b/src/algorithms/sorting/insertion-sort/README.md @@ -1,7 +1,8 @@ # Insertion Sort _Read this in other languages:_ -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. diff --git a/src/algorithms/sorting/insertion-sort/README.pt-BR.md b/src/algorithms/sorting/insertion-sort/README.pt-BR.md index abe93c2f1e..c5c0e368d2 100644 --- a/src/algorithms/sorting/insertion-sort/README.pt-BR.md +++ b/src/algorithms/sorting/insertion-sort/README.pt-BR.md @@ -1,7 +1,8 @@ # Insertion Sort _Leia isso em outros idiomas:_ -[_English_](README.md) +[_English_](README.md), +[_తెలుగు_](README.tel-IN.md) A ordenação por inserção é um algoritmo de ordenação simples que cria a matriz classificada final (ou lista) um item de cada vez. É muito menos eficiente em grandes listas do que mais algoritmos avançados, como quicksort, heapsort ou merge diff --git a/src/algorithms/sorting/insertion-sort/README.tel-IN.md b/src/algorithms/sorting/insertion-sort/README.tel-IN.md new file mode 100644 index 0000000000..18bc81d86a --- /dev/null +++ b/src/algorithms/sorting/insertion-sort/README.tel-IN.md @@ -0,0 +1,23 @@ +# Insertion Sort + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Português_](README.pt-BR.md) + +Insertion sort అనేది ఒక సింపుల్ sorting algorithm — చివరి sorted array (లేదా list) ని ఒక్కో item +కలుపుతూ కడుతుంది. పెద్ద lists మీద quicksort, heapsort, లేదా merge sort లాంటి advanced algorithms +తో పోలిస్తే ఇది చాలా slow. + +![Algorithm Visualization](https://upload.wikimedia.org/wikipedia/commons/4/42/Insertion_sort.gif) + +![Algorithm Visualization](https://upload.wikimedia.org/wikipedia/commons/0/0f/Insertion-sort-example-300px.gif) + +## Complexity + +| పేరు | Best | Average | Worst | Memory | Stable | Comments | +| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- | +| **Insertion sort** | n | n2 | n2 | 1 | అవును | | + +## References + +[Wikipedia](https://en.wikipedia.org/wiki/Insertion_sort) diff --git a/src/algorithms/sorting/merge-sort/README.md b/src/algorithms/sorting/merge-sort/README.md index 2931329482..bff32e7602 100644 --- a/src/algorithms/sorting/merge-sort/README.md +++ b/src/algorithms/sorting/merge-sort/README.md @@ -2,7 +2,8 @@ _Read this in other languages:_ [_한국어_](README.ko-KR.md), -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) In computer science, merge sort (also commonly spelled mergesort) is an efficient, general-purpose, diff --git a/src/algorithms/sorting/merge-sort/README.pt-BR.md b/src/algorithms/sorting/merge-sort/README.pt-BR.md index f7be449f04..f8d81a8c3f 100644 --- a/src/algorithms/sorting/merge-sort/README.pt-BR.md +++ b/src/algorithms/sorting/merge-sort/README.pt-BR.md @@ -2,7 +2,8 @@ _Leia isso em outros idiomas:_ [_한국어_](README.ko-KR.md), -[_English_](README.md) +[_English_](README.md), +[_తెలుగు_](README.tel-IN.md) Em ciência da computação, merge sort (também comumente escrito mergesort) é uma ferramenta eficiente, de propósito geral, diff --git a/src/algorithms/sorting/merge-sort/README.tel-IN.md b/src/algorithms/sorting/merge-sort/README.tel-IN.md new file mode 100644 index 0000000000..bdc74aa2c1 --- /dev/null +++ b/src/algorithms/sorting/merge-sort/README.tel-IN.md @@ -0,0 +1,33 @@ +# Merge Sort + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_한국어_](README.ko-KR.md), +[_Português_](README.pt-BR.md) + +Computer science లో merge sort (mergesort అని కూడా రాస్తారు) అనేది ఫాస్ట్ గా పనిచేసే, అన్ని +రకాల పనులకి వాడగలిగే, comparison మీద బేస్ అయిన sorting algorithm. చాలా implementations stable +sort ఇస్తాయి — అంటే సమానంగా ఉన్న elements input లో ఏ order లో ఉన్నాయో, sorted output లో కూడా అదే +order లో ఉంటాయి. Mergesort అనేది 1945 లో John von Neumann కనిపెట్టిన ఒక divide and conquer algorithm. + +Merge sort example. ముందు list ని అతి చిన్న ముక్కలుగా (1 element) విడగొట్టి, తర్వాత ప్రతి element ని +పక్కన ఉన్న list తో compare చేసి, sort చేసి, పక్కపక్కన ఉన్న రెండు lists ని కలుపుతాం (merge చేస్తాం). +చివరికి అన్ని elements sort అయి, కలిసిపోతాయి. + +![Merge Sort](https://upload.wikimedia.org/wikipedia/commons/c/cc/Merge-sort-example-300px.gif) + +7 integer values ఉన్న array ని sort చేయడానికి వాడిన recursive merge sort algorithm. Merge sort ని +(top-down) మనిషి చేతితో చేయాలంటే ఈ steps తీసుకుంటాడు. + +![Merge Sort](https://upload.wikimedia.org/wikipedia/commons/e/e6/Merge_sort_algorithm_diagram.svg) + +## Complexity + +| పేరు | Best | Average | Worst | Memory | Stable | Comments | +| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- | +| **Merge sort** | n log(n) | n log(n) | n log(n) | n | అవును | | + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Merge_sort) +- [YouTube](https://www.youtube.com/watch?v=KF2j-9iSf4Q&index=27&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/sorting/quick-sort/README.md b/src/algorithms/sorting/quick-sort/README.md index 9dcec0f12f..e03c3e233f 100644 --- a/src/algorithms/sorting/quick-sort/README.md +++ b/src/algorithms/sorting/quick-sort/README.md @@ -2,7 +2,8 @@ _Read this in other languages:_ [_简体中文_](README.zh-CN.md), -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) Quicksort is a divide and conquer algorithm. Quicksort first divides a large array into two smaller diff --git a/src/algorithms/sorting/quick-sort/README.pt-BR.md b/src/algorithms/sorting/quick-sort/README.pt-BR.md index ca3a45699f..18f3982d6c 100644 --- a/src/algorithms/sorting/quick-sort/README.pt-BR.md +++ b/src/algorithms/sorting/quick-sort/README.pt-BR.md @@ -2,7 +2,8 @@ _Leia isso em outros idiomas:_ [_简体中文_](README.zh-CN.md), -[_English_](README.md) +[_English_](README.md), +[_తెలుగు_](README.tel-IN.md) Quicksort é um algoritmo de dividir para conquistar. Quicksort primeiro divide uma grande matriz em duas menores diff --git a/src/algorithms/sorting/quick-sort/README.tel-IN.md b/src/algorithms/sorting/quick-sort/README.tel-IN.md new file mode 100644 index 0000000000..ff100cc585 --- /dev/null +++ b/src/algorithms/sorting/quick-sort/README.tel-IN.md @@ -0,0 +1,36 @@ +# Quicksort + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_简体中文_](README.zh-CN.md), +[_Português_](README.pt-BR.md) + +Quicksort అనేది ఒక divide and conquer algorithm. +Quicksort ముందు ఒక పెద్ద array ని రెండు చిన్న sub-arrays గా విడగొడుతుంది: చిన్న elements, పెద్ద +elements. తర్వాత Quicksort ఆ sub-arrays ని recursive గా sort చేస్తుంది. + +Steps ఇవి: + +1. Array నుంచి ఒక element ఎంచుకోండి, దాన్ని pivot అంటారు. +2. Partitioning: Array ని మళ్ళీ సర్దండి — pivot కంటే తక్కువ values ఉన్న elements అన్నీ pivot కంటే +ముందు రావాలి, pivot కంటే ఎక్కువ values ఉన్న elements అన్నీ దాని తర్వాత రావాలి (సమానమైన values +ఏ వైపైనా వెళ్ళొచ్చు). ఈ partitioning తర్వాత, pivot దాని చివరి position లో ఉంటుంది. దీన్నే +partition operation అంటారు. +3. పైన steps ని చిన్న values ఉన్న elements sub-array కి recursive గా వాడండి, అలాగే పెద్ద values +ఉన్న elements sub-array కి విడిగా వాడండి. + +Quicksort algorithm animated visualization. +అడ్డం గీతలు (horizontal lines) pivot values. + +![Quicksort](https://upload.wikimedia.org/wikipedia/commons/6/6a/Sorting_quicksort_anim.gif) + +## Complexity + +| పేరు | Best | Average | Worst | Memory | Stable | Comments | +| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- | +| **Quick sort** | n log(n) | n log(n) | n2 | log(n) | కాదు | Quicksort ని మామూలుగా in-place గా, O(log(n)) stack space తో చేస్తారు | + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Quicksort) +- [YouTube](https://www.youtube.com/watch?v=SLauY6PpjW4&index=28&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/sorting/radix-sort/README.md b/src/algorithms/sorting/radix-sort/README.md index 108d7d19b6..2768c3b4c5 100644 --- a/src/algorithms/sorting/radix-sort/README.md +++ b/src/algorithms/sorting/radix-sort/README.md @@ -2,6 +2,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) In computer science, **radix sort** is a non-comparative integer sorting algorithm that sorts data with integer keys by grouping keys by the individual diff --git a/src/algorithms/sorting/radix-sort/README.pt-BR.md b/src/algorithms/sorting/radix-sort/README.pt-BR.md index 2274440984..7e54f93774 100644 --- a/src/algorithms/sorting/radix-sort/README.pt-BR.md +++ b/src/algorithms/sorting/radix-sort/README.pt-BR.md @@ -1,7 +1,8 @@ # Radix Sort _Leia isso em outros idiomas:_ -[_English_](README.md) +[_English_](README.md), +[_తెలుగు_](README.tel-IN.md) Em ciência da computação, **radix sort** é uma classificação inteira não comparativa algoritmo que classifica os dados com chaves inteiras agrupando as chaves pelo indivíduo diff --git a/src/algorithms/sorting/radix-sort/README.tel-IN.md b/src/algorithms/sorting/radix-sort/README.tel-IN.md new file mode 100644 index 0000000000..9e5ff6a94c --- /dev/null +++ b/src/algorithms/sorting/radix-sort/README.tel-IN.md @@ -0,0 +1,45 @@ +# Radix Sort + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Português_](README.pt-BR.md) + +Computer science లో **radix sort** అనేది compare చేయకుండా పనిచేసే (non-comparative) integer sorting +algorithm. Integer keys ఉన్న data ని, ఒకే significant position లో ఒకే value ఉన్న digits ని బట్టి +keys ని groups గా చేసి sort చేస్తుంది. దీనికి positional notation కావాలి, కానీ integers తో characters +strings (ఉదాహరణకి పేర్లు లేదా dates) ని, ప్రత్యేకంగా format చేసిన floating point numbers ని కూడా +చూపించొచ్చు కాబట్టి, radix sort integers కి మాత్రమే పరిమితం కాదు. + +*ఈ పేరు ఎక్కడి నుంచి వచ్చింది?* + +Mathematical numeral systems లో, *radix* లేదా base అంటే positional numeral system లో నంబర్లని +చూపించడానికి వాడే unique digits సంఖ్య (zero digit తో సహా). ఉదాహరణకి, binary system (0, 1 నంబర్లు +వాడేది) radix 2, decimal system (0 నుంచి 9 వరకు నంబర్లు వాడేది) radix 10. + +## Efficiency + +వేరే sorting algorithms తో పోలిస్తే radix sort ఎంత efficient అనే విషయం కొంచెం tricky, దీని గురించి +చాలా అపార్థాలు ఉన్నాయి. బెస్ట్ comparison-based algorithms తో పోలిస్తే radix sort సమానంగా efficient +ఆ, తక్కువ efficient ఆ, ఎక్కువ efficient ఆ అనేది — మనం ఏం అనుకుంటున్నాం (assumptions) అనేదాని +details మీద ఆధారపడి ఉంటుంది. Word size `w` ఉన్న integers అయిన `n` keys కి radix sort complexity +`O(wn)`. కొన్నిసార్లు `w` ని ఒక constant గా చూపిస్తారు — అలా అయితే radix sort (`n` సరిపోయేంత పెద్దగా +ఉన్నప్పుడు) బెస్ట్ comparison-based sorting algorithms కంటే బెటర్ అవుతుంది, ఎందుకంటే అవన్నీ `n` keys +sort చేయడానికి `O(n log n)` comparisons చేస్తాయి. కానీ, జనరల్ గా `w` ని constant గా చూడలేం: `n` keys +అన్నీ వేరువేరుగా ఉంటే, random-access machine వాటిని memory లో store చేయాలంటే `w` కనీసం `log n` ఉండాలి, +దాంతో బెస్ట్ అయినా time complexity `O(n log n)` వస్తుంది. అంటే radix sort మహా అయితే బెస్ట్ +comparison-based sorts తో సమానంగా efficient గా ఉంటుంది అనిపిస్తుంది (keys `log n` కంటే చాలా +పొడవుగా ఉంటే ఇంకా worse). + +![Radix Sort](./images/radix-sort.png) + +## Complexity + +| పేరు | Best | Average | Worst | Memory | Stable | Comments | +| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- | +| **Radix sort** | n * k | n * k | n * k | n + k | అవును | k - అతి పొడవైన key యొక్క length | + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Radix_sort) +- [YouTube](https://www.youtube.com/watch?v=XiuSW_mEn7g&index=62&t=0s&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) +- [ResearchGate](https://www.researchgate.net/figure/Simplistic-illustration-of-the-steps-performed-in-a-radix-sort-In-this-example-the_fig1_291086231) diff --git a/src/algorithms/sorting/selection-sort/README.md b/src/algorithms/sorting/selection-sort/README.md index 005c616131..b358909e4d 100644 --- a/src/algorithms/sorting/selection-sort/README.md +++ b/src/algorithms/sorting/selection-sort/README.md @@ -1,7 +1,8 @@ # Selection Sort _Read this in other languages:_ -[_Português_](README.pt-BR.md). +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md). Selection sort is a sorting algorithm, specifically an in-place comparison sort. It has O(n2) time complexity, diff --git a/src/algorithms/sorting/selection-sort/README.pt-BR.md b/src/algorithms/sorting/selection-sort/README.pt-BR.md index 0c45b73f61..13bd92b59c 100644 --- a/src/algorithms/sorting/selection-sort/README.pt-BR.md +++ b/src/algorithms/sorting/selection-sort/README.pt-BR.md @@ -1,7 +1,8 @@ # Selection Sort _Leia isso em outros idiomas:_ -[_English_](README.md). +[_English_](README.md), +[_తెలుగు_](README.tel-IN.md). Selection Sort é um algoritmo de ordenação, mais especificamente um algoritmo de ordenação por comparação in-place (requer uma quantidade constante de espaço de memória adicional). Tem complexidade O(n²), tornando-o ineficiente em listas grandes e, geralmente, tem desempenho inferior ao similar Insertion Sort. O Selection Sort é conhecido por sua simplicidade e tem vantagens de desempenho sobre algoritmos mais complexos em certas situações, particularmente quando a memória auxiliar é limitada. diff --git a/src/algorithms/sorting/selection-sort/README.tel-IN.md b/src/algorithms/sorting/selection-sort/README.tel-IN.md new file mode 100644 index 0000000000..6ff8d7ae67 --- /dev/null +++ b/src/algorithms/sorting/selection-sort/README.tel-IN.md @@ -0,0 +1,25 @@ +# Selection Sort + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Português_](README.pt-BR.md) + +Selection sort అనేది ఒక sorting algorithm, ప్రత్యేకంగా చెప్పాలంటే in-place comparison sort. దీని +time complexity O(n2), అందుకే పెద్ద lists మీద ఇది slow గా ఉంటుంది, ఇంకా జనరల్ గా దీనిలాంటిదే అయిన +insertion sort కంటే worse గా పనిచేస్తుంది. Selection sort సింపుల్ గా ఉండటానికి ఫేమస్, ఇంకా కొన్ని +situations లో — ముఖ్యంగా అదనపు memory తక్కువగా ఉన్నప్పుడు — కష్టమైన algorithms కంటే దీనికి +performance advantages ఉన్నాయి. + +![Algorithm Visualization](https://upload.wikimedia.org/wikipedia/commons/b/b0/Selection_sort_animation.gif) + +![Algorithm Visualization](https://upload.wikimedia.org/wikipedia/commons/9/94/Selection-Sort-Animation.gif) + +## Complexity + +| పేరు | Best | Average | Worst | Memory | Stable | Comments | +| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- | +| **Selection sort** | n2 | n2 | n2 | 1 | కాదు | | + +## References + +[Wikipedia](https://en.wikipedia.org/wiki/Selection_sort) diff --git a/src/algorithms/sorting/shell-sort/README.md b/src/algorithms/sorting/shell-sort/README.md index f93338e2eb..8369af4634 100644 --- a/src/algorithms/sorting/shell-sort/README.md +++ b/src/algorithms/sorting/shell-sort/README.md @@ -1,7 +1,8 @@ # Shellsort _Read this in other languages:_ -[_Português_](README.pt-BR.md). +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md). Shellsort, also known as Shell sort or Shell's method, is an in-place comparison sort. It can be seen as either a diff --git a/src/algorithms/sorting/shell-sort/README.pt-BR.md b/src/algorithms/sorting/shell-sort/README.pt-BR.md index 14de1a517e..97e1be7e9d 100644 --- a/src/algorithms/sorting/shell-sort/README.pt-BR.md +++ b/src/algorithms/sorting/shell-sort/README.pt-BR.md @@ -1,7 +1,8 @@ # Shellsort _Leia isso em outros idiomas:_ -[_English_](README.md). +[_English_](README.md), +[_తెలుగు_](README.tel-IN.md). Shellsort, também conhecido como Shell sort ou método de Shell, é uma classificação de comparação in-loco. Pode ser visto tanto como um diff --git a/src/algorithms/sorting/shell-sort/README.tel-IN.md b/src/algorithms/sorting/shell-sort/README.tel-IN.md new file mode 100644 index 0000000000..a252c7652a --- /dev/null +++ b/src/algorithms/sorting/shell-sort/README.tel-IN.md @@ -0,0 +1,55 @@ +# Shellsort + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Português_](README.pt-BR.md) + +Shellsort (దీన్నే Shell sort లేదా Shell's method అని కూడా అంటారు) అనేది ఒక in-place comparison sort. +దీన్ని exchange తో sorting (bubble sort) కి గానీ, insertion తో sorting (insertion sort) కి గానీ ఒక +జనరల్ version గా చూడొచ్చు. ఈ పద్ధతి ఒకదానికొకటి దూరంగా ఉన్న elements జంటలని sort చేయడంతో మొదలై, +తర్వాత compare చేసే elements మధ్య దూరాన్ని (gap) కొద్దికొద్దిగా తగ్గిస్తూ వెళ్తుంది. దూరంగా ఉన్న +elements తో మొదలుపెట్టడం వల్ల, తప్పు చోట ఉన్న కొన్ని elements ని సింపుల్ పక్క-పక్క exchange కంటే +ఫాస్ట్ గా కరెక్ట్ position కి జరపొచ్చు. + +![Shellsort](https://upload.wikimedia.org/wikipedia/commons/d/d8/Sorting_shellsort_anim.gif) + +## Shell Sort ఎలా పనిచేస్తుంది + +మన example కోసం, ఈజీగా అర్థమవ్వడానికి interval `4` తీసుకుందాం. 4 positions దూరంలో ఉన్న అన్ని values +తో ఒక virtual sub-list తయారుచేయండి. ఇక్కడ ఆ values `{35, 14}`, `{33, 19}`, `{42, 27}`, `{10, 44}` + +![Shellsort](https://www.tutorialspoint.com/data_structures_algorithms/images/shell_sort_gap_4.jpg) + +ప్రతి sub-list లో values ని compare చేసి, (అవసరమైతే) original array లో వాటిని swap చేస్తాం. ఈ step +తర్వాత కొత్త array ఇలా ఉండాలి + +![Shellsort](https://www.tutorialspoint.com/data_structures_algorithms/images/shell_sort_step_1.jpg) + +తర్వాత interval 2 తీసుకుంటాం, ఈ gap తో రెండు sub-lists వస్తాయి +- `{14, 27, 35, 42}`, `{19, 10, 33, 44}` + +![Shellsort](https://www.tutorialspoint.com/data_structures_algorithms/images/shell_sort_gap_2.jpg) + +అవసరమైతే original array లో values ని compare చేసి swap చేస్తాం. +ఈ step తర్వాత array ఇలా ఉండాలి + +![Shellsort](https://www.tutorialspoint.com/data_structures_algorithms/images/shell_sort_step_2.jpg) + +> UPD: కింద ఉన్న బొమ్మలో ఒక typo (తప్పు) ఉంది, result array `[14, 10, 27, 19, 35, 33, 42, 44]` అయి ఉండాలి. + +చివరగా, మిగిలిన array ని interval value 1 తో sort చేస్తాం. Array ని sort చేయడానికి Shell sort +insertion sort వాడుతుంది. + +![Shellsort](https://www.tutorialspoint.com/data_structures_algorithms/images/shell_sort.jpg) + +## Complexity + +| పేరు | Best | Average | Worst | Memory | Stable | Comments | +| --------------------- | :-------------: | :-----------------: | :-----------------: | :-------: | :-------: | :-------- | +| **Shell sort** | n log(n) | gap sequence ని బట్టి మారుతుంది | n (log(n))2 | 1 | కాదు | | + +## References + +- [Tutorials Point](https://www.tutorialspoint.com/data_structures_algorithms/shell_sort_algorithm.htm) +- [Wikipedia](https://en.wikipedia.org/wiki/Shellsort) +- [YouTube లో Rob Edwards](https://www.youtube.com/watch?v=ddeLSDsYVp8&index=79&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/stack/valid-parentheses/README.md b/src/algorithms/stack/valid-parentheses/README.md index 31d7fd60f3..6e1494ca75 100644 --- a/src/algorithms/stack/valid-parentheses/README.md +++ b/src/algorithms/stack/valid-parentheses/README.md @@ -1,5 +1,8 @@ # Valid Parentheses Problem +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: diff --git a/src/algorithms/stack/valid-parentheses/README.tel-IN.md b/src/algorithms/stack/valid-parentheses/README.tel-IN.md new file mode 100644 index 0000000000..e30ac6837c --- /dev/null +++ b/src/algorithms/stack/valid-parentheses/README.tel-IN.md @@ -0,0 +1,47 @@ +# Valid Parentheses Problem + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +'(', ')', '{', '}', '[', ']' అనే characters మాత్రమే ఉన్న ఒక string s ఇస్తే, ఆ input string valid ఆ కాదా నిర్ణయించాలి. + +Input string valid అవ్వాలంటే: + +తెరిచిన brackets ని అదే రకం brackets తో మూయాలి. +తెరిచిన brackets ని కరెక్ట్ order లో మూయాలి. +మూసే ప్రతి bracket కి, అదే రకం తెరిచే bracket ఒకటి ఉండాలి. + + +Example 1: + +`Input: s = "()"` + +Output: true + +Example 2: + +`Input: s = "()[]{}"` + +Output: true + +Example 3: + +`Input: s = "(]"` + +Output: false + +ఇది నిజానికి interviews లో చాలా ఎక్కువగా అడిగే ప్రశ్న, ఇంకా problems solve చేయడానికి stack data structure ఎలా వాడాలో చెప్పడానికి చాలా మంచి example. + +## Solution +ఈ problem ని రెండు రకాలుగా solve చేయొచ్చు + +### Bruteforce Approach +String మీద iterate చేస్తూ, string లో ప్రతి character కి, దాని చివరి closing character string లో ఎక్కడ ఉందో చెక్ చేయొచ్చు. String లో చివరి closing character దొరికాక, రెండు characters ని తీసేసి మళ్ళీ iteration చేస్తాం. ఏదైనా opening character కి closing character దొరకకపోతే, string invalid. దీని time complexity O(n^2), ఇది అంత efficient కాదు. + +### Stack వాడి +అన్ని opening characters ని store చేయడానికి ఒక hashtable వాడొచ్చు, దాని value సంబంధిత closing character. తర్వాత string మీద iterate చేస్తూ, opening parentheses కనిపిస్తే, దాని closing character ని stack లోకి push చేస్తాం. Closing parentheses కనిపిస్తే, stack నుంచి pop చేసి, pop అయిన element ఇప్పటి closing parentheses character కి సమానమా అని కన్ఫర్మ్ చేస్తాం. సమానం కాకపోతే string invalid. Iteration అయిపోయాక, stack ఖాళీగా ఉందా అని కూడా చెక్ చేయాలి. ఖాళీగా లేకపోతే string invalid. ఖాళీగా ఉంటే, string valid. ఇది ఇంకా efficient approach — దీని Time complexity, Space complexity రెండూ O(n). + + +## References + +- [Leetcode](https://leetcode.com/problems/valid-parentheses/) diff --git a/src/algorithms/statistics/weighted-random/README.md b/src/algorithms/statistics/weighted-random/README.md index 16e459704b..faf9ce01d7 100644 --- a/src/algorithms/statistics/weighted-random/README.md +++ b/src/algorithms/statistics/weighted-random/README.md @@ -1,5 +1,8 @@ # Weighted Random +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + ![Weighted Random](images/cover.png) ## What is "Weighted Random" diff --git a/src/algorithms/statistics/weighted-random/README.tel-IN.md b/src/algorithms/statistics/weighted-random/README.tel-IN.md new file mode 100644 index 0000000000..730f9f79dd --- /dev/null +++ b/src/algorithms/statistics/weighted-random/README.tel-IN.md @@ -0,0 +1,146 @@ +# Weighted Random + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +![Weighted Random](images/cover.png) + +## "Weighted Random" అంటే ఏంటి + +మీ దగ్గర **items** list ఒకటి ఉంది అనుకుందాం. Item ఏదైనా కావొచ్చు. ఉదాహరణకి, మీకు తినడానికి ఇష్టమైన fruits, vegetables list: `[ '🍌', '🍎', '🥕' ]`. + +**Weights** list ప్రతి item యొక్క weight (లేదా probability, లేదా ఎంత ముఖ్యం) ని చూపిస్తుంది. Weights అంటే నంబర్లు. ఉదాహరణకి, `[3, 7, 1]` లాంటి weights ఇలా చెప్తాయి: + +- మీరు `🍎 apples` ఎక్కువసార్లు తినాలనుకుంటారు (`3 + 7 + 1 = 11` సార్లలో `7` సార్లు), +- `bananas 🍌` తక్కువసార్లు తినాలనుకుంటారు (`11` సార్లలో `3` సార్లు మాత్రమే), +- ఇంకా `carrots 🥕` మీకు అస్సలు ఇష్టం లేదు (`11` సార్లలో `1` సారి మాత్రమే తినాలనుకుంటారు). + +> Probabilities పరంగా మాట్లాడితే, weights list అనేది మొత్తం `1` వచ్చే floats array కావొచ్చు (ఉదాహరణకి `[0.1, 0.5, 0.2, 0.2]`). + +ఇక్కడ **Weighted Random** అంటే list నుంచి random గా ఒక item ఇచ్చే function — కానీ ప్రతి item weight ని లెక్కలోకి తీసుకుంటుంది, కాబట్టి ఎక్కువ weight ఉన్న items ఎక్కువసార్లు వస్తాయి. + +Function interface example: + +```javascript +const items = [ '🍌', '🍎', '🥕' ]; +const weights = [ 3, 7, 1 ]; + +function weightedRandom(items, weights) { + // implementation goes here ... +} + +const nextSnackToEat = weightedRandom(items, weights); // Could be '🍎' +``` + +## Weighted Random ని ఎక్కడ వాడతారు + +- [Genetic Algorithm](https://en.wikipedia.org/wiki/Genetic_algorithm) లో "Selection" phase లో weighted random వాడతారు — తర్వాత ఇంకా బలమైన generation తయారుచేయడానికి, fitness score ని బట్టి అతి fit/బలమైన individuals ని ఎంచుకోవాల్సినప్పుడు. [500 Lines of Code లో Self-Parking Car](https://trekhleb.dev/blog/2021/self-parking-car-evolution/) article లో ఒక **example** చూడొచ్చు. +- [Recurrent Neural Networks (RNN)](https://en.wikipedia.org/wiki/Recurrent_neural_network) లో, next letter probability ని బట్టి (sentence తయారుచేయడానికి) next ఏ letter ఎంచుకోవాలో నిర్ణయించేటప్పుడు. [Recurrent Neural Network (RNN) తో Recipe Generation](https://nbviewer.org/github/trekhleb/machine-learning-experiments/blob/master/experiments/recipe_generation_rnn/recipe_generation_rnn.ipynb) Jupyter notebook లో ఒక **example** చూడొచ్చు. +- [Nginx Load Balancing](https://docs.nginx.com/nginx/admin-guide/load-balancer/http-load-balancer/) లో, ఎక్కువ weights ఉన్న servers కి HTTP requests ఎక్కువసార్లు పంపడానికి. +- ఇంకా చాలా... + +## Algorithm + +**డైరెక్ట్ పద్ధతి** ఇది: + +1. List లో ప్రతి item ని దాని weight అన్నిసార్లు రిపీట్ చేయండి. +2. List నుంచి random గా ఒక item ఎంచుకోండి. + +ఉదాహరణకి మన fruits, vegetables case లో `3 + 7 + 1 = 11` సైజ్ ఉన్న ఈ list తయారుచేయొచ్చు: + +```javascript +const items = [ '🍌', '🍎', '🥕' ]; +const weights = [ 3, 7, 1 ]; + +// Repeating the items based on weights. +const weightedItems = [ + '🍌', '🍌', '🍌', + '🍎', '🍎', '🍎', '🍎', '🍎', '🍎', '🍎', + '🥕', +]; + +// And now just pick the random item from weightedItems array. +``` + +కానీ, చూడొచ్చు — `weightedItems` list లో రిపీట్ చేయాల్సిన items చాలా ఉంటే, ఈ పద్ధతికి చాలా memory కావాలి. `"some-random-string"` (`18` bytes) లాంటి string ని కోటి సార్లు రిపీట్ చేయాలి అనుకోండి. కేవలం ఈ array కోసమే దాదాపు `180Mb` అదనపు memory కేటాయించాలి. + +**ఇంకా efficient పద్ధతి** ఇది: + +1. ప్రతి item కి cumulative weights (కూడుతూ వెళ్ళే weights) list తయారుచేయండి (అంటే original `weights` list లో ఎన్ని elements ఉన్నాయో అన్నే ఉండే `cumulativeWeights` list). మన case లో అది ఇలా ఉంటుంది: `cumulativeWeights = [3, 3 + 7, 3 + 7 + 1] = [3, 10, 11]` +2. `0` నుంచి అతి పెద్ద cumulative weight value వరకు ఒక random నంబర్ `randomNumber` తయారుచేయండి. మన case లో random నంబర్ `[0..11]` range లో ఉంటుంది. `randomNumber = 8` వచ్చింది అనుకుందాం. +3. `cumulativeWeights` list మీద ఎడమ నుంచి కుడికి వెళ్తూ, `randomNumber` కంటే ఎక్కువ లేదా సమానంగా ఉన్న మొదటి element ని ఎంచుకోండి. ఆ element index తో `items` array నుంచి item తీసుకుంటాం. + +ఈ పద్ధతి వెనక ఐడియా ఏంటంటే — ఎక్కువ weights ఎక్కువ నంబర్ల స్థలాన్ని "ఆక్రమిస్తాయి". కాబట్టి random నంబర్ "ఎక్కువ weight ఉన్న నంబర్ల bucket" లో పడే chance ఎక్కువ. + +```javascript +const weights = [3, 7, 1 ]; +const cumulativeWeights = [3, 10, 11]; + +// In a pseudo-representation we may think about the cumulativeWeights array like this. +const pseudoCumulativeWeights = [ + 1, 2, 3, // <-- [3] numbers + 4, 5, 6, 7, 8, 9, 10, // <-- [7] numbers + 11, // <-- [1] number +]; +``` + +`weightedRandom` function ని ఎలా implement చేయొచ్చో example ఇది: + +```javascript +/** + * Picks the random item based on its weight. + * The items with higher weight will be picked more often (with a higher probability). + * + * For example: + * - items = ['banana', 'orange', 'apple'] + * - weights = [0, 0.2, 0.8] + * - weightedRandom(items, weights) in 80% of cases will return 'apple', in 20% of cases will return + * 'orange' and it will never return 'banana' (because probability of picking the banana is 0%) + * + * @param {any[]} items + * @param {number[]} weights + * @returns {{item: any, index: number}} + */ +export default function weightedRandom(items, weights) { + if (items.length !== weights.length) { + throw new Error('Items and weights must be of the same size'); + } + + if (!items.length) { + throw new Error('Items must not be empty'); + } + + // Preparing the cumulative weights array. + // For example: + // - weights = [1, 4, 3] + // - cumulativeWeights = [1, 5, 8] + const cumulativeWeights = []; + for (let i = 0; i < weights.length; i += 1) { + cumulativeWeights[i] = weights[i] + (cumulativeWeights[i - 1] || 0); + } + + // Getting the random number in a range of [0...sum(weights)] + // For example: + // - weights = [1, 4, 3] + // - maxCumulativeWeight = 8 + // - range for the random number is [0...8] + const maxCumulativeWeight = cumulativeWeights[cumulativeWeights.length - 1]; + const randomNumber = maxCumulativeWeight * Math.random(); + + // Picking the random item based on its weight. + // The items with higher weight will be picked more often. + for (let itemIndex = 0; itemIndex < items.length; itemIndex += 1) { + if (cumulativeWeights[itemIndex] >= randomNumber) { + return { + item: items[itemIndex], + index: itemIndex, + }; + } + } +} +``` + +## Implementation + +- `weightedRandom()` function implementation కోసం [weightedRandom.js](weightedRandom.js) file చూడండి. +- Test-cases కోసం [weightedRandom.test.js](__test__/weightedRandom.test.js) file చూడండి. diff --git a/src/algorithms/string/hamming-distance/README.md b/src/algorithms/string/hamming-distance/README.md index 516a8e0372..ba7e919788 100644 --- a/src/algorithms/string/hamming-distance/README.md +++ b/src/algorithms/string/hamming-distance/README.md @@ -1,5 +1,8 @@ # Hamming Distance +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + the Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. In other words, it measures the minimum number of diff --git a/src/algorithms/string/hamming-distance/README.tel-IN.md b/src/algorithms/string/hamming-distance/README.tel-IN.md new file mode 100644 index 0000000000..0457949c44 --- /dev/null +++ b/src/algorithms/string/hamming-distance/README.tel-IN.md @@ -0,0 +1,23 @@ +# Hamming Distance + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +ఒకే పొడవు ఉన్న రెండు strings మధ్య Hamming distance అంటే — ఎన్ని positions లో వాటి symbols +వేరువేరుగా ఉన్నాయో ఆ సంఖ్య. ఇంకోలా చెప్పాలంటే, ఒక string ని ఇంకో string గా మార్చడానికి కనీసం +ఎన్ని మార్పులు (substitutions) కావాలో, లేదా ఒక string ఇంకో string గా మారడానికి కనీసం ఎన్ని +errors జరిగి ఉండొచ్చో అది కొలుస్తుంది. ఇంకా జనరల్ గా చెప్పాలంటే, రెండు sequences మధ్య edit +distance కొలవడానికి ఉన్న చాలా string metrics లో Hamming distance ఒకటి. + +## Examples + +వీటి మధ్య Hamming distance: + +- "ka**rol**in", "ka**thr**in" మధ్య **3**. +- "k**a**r**ol**in", "k**e**r**st**in" మధ్య **3**. +- 10**1**1**1**01, 10**0**1**0**01 మధ్య **2**. +- 2**17**3**8**96, 2**23**3**7**96 మధ్య **3**. + +## References + +[Wikipedia](https://en.wikipedia.org/wiki/Hamming_distance) diff --git a/src/algorithms/string/knuth-morris-pratt/README.md b/src/algorithms/string/knuth-morris-pratt/README.md index 907ff60c06..b27c677dec 100644 --- a/src/algorithms/string/knuth-morris-pratt/README.md +++ b/src/algorithms/string/knuth-morris-pratt/README.md @@ -1,5 +1,8 @@ # Knuth–Morris–Pratt Algorithm +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + The Knuth–Morris–Pratt string searching algorithm (or KMP algorithm) searches for occurrences of a "word" `W` within a main "text string" `T` by employing the diff --git a/src/algorithms/string/knuth-morris-pratt/README.tel-IN.md b/src/algorithms/string/knuth-morris-pratt/README.tel-IN.md new file mode 100644 index 0000000000..9d09d89cfc --- /dev/null +++ b/src/algorithms/string/knuth-morris-pratt/README.tel-IN.md @@ -0,0 +1,19 @@ +# Knuth–Morris–Pratt Algorithm + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Knuth–Morris–Pratt string searching algorithm (లేదా KMP algorithm) ఒక main "text string" `T` లో +"word" `W` ఎక్కడెక్కడ ఉందో వెతుకుతుంది. ఇది ఒక విషయం గమనిస్తుంది — mismatch జరిగినప్పుడు, next +match ఎక్కడ మొదలవ్వొచ్చో నిర్ణయించడానికి కావాల్సిన సమాచారం word లోనే ఉంటుంది. దాంతో ఇంతకుముందు +match అయిన characters ని మళ్ళీ చెక్ చేయాల్సిన పని ఉండదు. + +## Complexity + +- **Time:** `O(|W| + |T|)` (మామూలు `O(|W| * |T|)` తో పోలిస్తే చాలా ఫాస్ట్) +- **Space:** `O(|W|)` + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm) +- [YouTube](https://www.youtube.com/watch?v=GTJr8OvyEVQ&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/string/levenshtein-distance/README.md b/src/algorithms/string/levenshtein-distance/README.md index 8876d6791c..2c44f3bae0 100644 --- a/src/algorithms/string/levenshtein-distance/README.md +++ b/src/algorithms/string/levenshtein-distance/README.md @@ -1,5 +1,8 @@ # Levenshtein Distance +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + The Levenshtein distance is a string metric for measuring the difference between two sequences. Informally, the Levenshtein distance between two words is the minimum number of diff --git a/src/algorithms/string/levenshtein-distance/README.tel-IN.md b/src/algorithms/string/levenshtein-distance/README.tel-IN.md new file mode 100644 index 0000000000..5bdccbb1a3 --- /dev/null +++ b/src/algorithms/string/levenshtein-distance/README.tel-IN.md @@ -0,0 +1,103 @@ +# Levenshtein Distance + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Levenshtein distance అనేది రెండు sequences మధ్య తేడా కొలిచే ఒక string metric. సింపుల్ గా చెప్పాలంటే, +రెండు words మధ్య Levenshtein distance అంటే — ఒక word ని ఇంకో word గా మార్చడానికి కనీసం ఎన్ని +single-character మార్పులు (insertions, deletions లేదా substitutions) కావాలో ఆ సంఖ్య. + +## Definition + +Mathematics పరంగా, `a`, `b` అనే రెండు strings (పొడవు వరుసగా `|a|`, `|b|`) మధ్య Levenshtein distance +![Levenshtein](https://wikimedia.org/api/rest_v1/media/math/render/svg/4cf357d8f2135035207088d2c7b890fb4b64e410) +ఇక్కడ + +![Levenshtein](https://wikimedia.org/api/rest_v1/media/math/render/svg/f0a48ecfc9852c042382fdc33c19e11a16948e85) + +ఇక్కడ +![Levenshtein](https://wikimedia.org/api/rest_v1/media/math/render/svg/52512ede08444b13838c570ba4a3fc71d54dbce9) +అనేది ఒక indicator function — +![Levenshtein](https://wikimedia.org/api/rest_v1/media/math/render/svg/231fda9ee578f0328c5ca28088d01928bb0aaaec) +అయినప్పుడు `0`, లేకపోతే 1. ఇంకా +![Levenshtein](https://wikimedia.org/api/rest_v1/media/math/render/svg/bdc0315678caad28648aafedb6ebafb16bd1655c) +అంటే `a` లో మొదటి `i` characters కి, `b` లో మొదటి `j` characters కి మధ్య distance. + +గమనించండి — minimum లో మొదటి element deletion (`a` నుంచి `b` కి), రెండోది insertion, మూడోది +match లేదా mismatch (సంబంధిత symbols ఒకటేనా కాదా అనేదాన్ని బట్టి). + +## Example + +ఉదాహరణకి, `kitten`, `sitting` మధ్య Levenshtein distance `3` — ఎందుకంటే కింద ఉన్న మూడు మార్పులతో +ఒకటి ఇంకోటిగా మారుతుంది, మూడు కంటే తక్కువ మార్పులతో చేయడం కుదరదు: + +1. **k**itten → **s**itten ("k" బదులు "s") +2. sitt**e**n → sitt**i**n ("e" బదులు "i") +3. sittin → sittin**g** (చివర్లో "g" కలపడం). + +## ఎక్కడ వాడతారు + +దీన్ని చాలా చోట్ల వాడతారు — ఉదాహరణకి spell checkers, optical character recognition కి correction +systems, fuzzy string searching, ఇంకా translation memory మీద బేస్ అయిన natural language translation +కి సాయం చేసే software. + +## Dynamic Programming Approach Explanation + +`ME`, `MY` strings మధ్య minimum edit distance కనుక్కునే సింపుల్ example తీసుకుందాం. ఇక్కడ minimum +edit distance `1` operation అని మీకు ఇప్పటికే అర్థమైపోయి ఉంటుంది — `E` బదులు `Y` పెట్టడం. కానీ +`Saturday` ని `Sunday` గా మార్చడం లాంటి కష్టమైన examples కూడా చేయగలగాలంటే, దీన్ని ఒక algorithm +రూపంలో పెట్టడానికి ట్రై చేద్దాం. + +పైన చెప్పిన mathematical formula ని `ME → MY` మార్పుకి వాడాలంటే, ముందే `ME → M`, `M → MY`, `M → M` +మార్పుల minimum edit distances తెలియాలి. తర్వాత వాటిలో minimum దాన్ని ఎంచుకుని, చివరి letters +`E → Y` మార్చడానికి _ఒక_ operation కలపాలి. అంటే `ME → MY` మార్పు minimum edit distance ని, ముందు +possible అయిన మూడు మార్పుల మీద బేస్ చేసి లెక్కపెడతాం. + +ఇంకా బాగా explain చేయడానికి ఈ matrix గీద్దాం: + +![Levenshtein Matrix](https://cdn-images-1.medium.com/max/1600/1*aTunSUoy0BJyYBVn4tWGrA.png) + +- Cell `(0:1)` లో ఎరుపు నంబర్ 1 ఉంది. అంటే `M` ని empty string గా మార్చడానికి 1 operation కావాలి. +అది `M` ని డిలీట్ చేయడం. అందుకే ఈ నంబర్ ఎరుపు. +- Cell `(0:2)` లో ఎరుపు నంబర్ 2 ఉంది. అంటే `ME` ని empty string గా మార్చడానికి 2 operations కావాలి. +అది `E`, `M` ని డిలీట్ చేయడం. +- Cell `(1:0)` లో ఆకుపచ్చ నంబర్ 1 ఉంది. అంటే empty string ని `M` గా మార్చడానికి 1 operation కావాలి. +అది `M` ని కలపడం (insert). అందుకే ఈ నంబర్ ఆకుపచ్చ. +- Cell `(2:0)` లో ఆకుపచ్చ నంబర్ 2 ఉంది. అంటే empty string ని `MY` గా మార్చడానికి 2 operations కావాలి. +అది `Y`, `M` ని కలపడం. +- Cell `(1:1)` లో నంబర్ 0 ఉంది. అంటే `M` ని `M` గా మార్చడానికి ఏమీ ఖర్చు లేదు. +- Cell `(1:2)` లో ఎరుపు నంబర్ 1 ఉంది. అంటే `ME` ని `M` గా మార్చడానికి 1 operation కావాలి. +అది `E` ని డిలీట్ చేయడం. +- అలా మిగతావి... + +మన matrix లాంటి చిన్న దానికి (ఇది కేవలం `3x3`) ఇది ఈజీగా అనిపిస్తుంది. కానీ ఇక్కడ ఉన్న బేసిక్ +concepts తో పెద్ద matrices కి కూడా (ఉదాహరణకి `Saturday → Sunday` మార్పుకి `9x7` matrix) ఆ నంబర్లన్నీ +లెక్కపెట్టొచ్చు. + +Formula ప్రకారం, ఇప్పటి cell `(i:j)` నంబర్ లెక్కపెట్టడానికి పక్కన ఉన్న మూడు cells `(i-1:j)`, `(i-1:j-1)`, +`(i:j-1)` ఉంటే చాలు. ఆ మూడు cells లో minimum కనుక్కుని, `i` row లో, `j` column లో వేరువేరు letters +ఉంటే `1` కలపాలి అంతే. + +ఈ problem recursive గా ఉంది అని క్లియర్ గా చూడొచ్చు. + +![Levenshtein Matrix](https://cdn-images-1.medium.com/max/1600/1*w8UB4DSvBnAK6mBXRGQDjw.png) + +ఈ problem కి ఒక decision graph గీద్దాం. + +![Minimum Edit Distance Decision Graph](https://cdn-images-1.medium.com/max/1600/1*8jD0qvr5B9PwRFM_9z7q9A.png) + +బొమ్మలో ఎరుపు రంగుతో mark చేసిన, ఒకదానితో ఒకటి overlap అయ్యే చాలా sub-problems చూడొచ్చు. ఇంకా, +formula లో పక్కన ఉన్న ఆ మూడు cells minimum కంటే operations సంఖ్య తగ్గించడం కుదరదు. + +ఇంకా గమనించొచ్చు — matrix లో ప్రతి cell నంబర్ ముందు వాటి మీద బేస్ చేసి లెక్కపెడతాం. కాబట్టి ఇక్కడ +tabulation technique (cache ని కింద నుంచి పైకి — bottom-up — నింపడం) వాడతాం. + +ఈ సూత్రాన్ని ఇంకా ముందుకి తీసుకెళ్తే, `Saturday → Sunday` మార్పు లాంటి కష్టమైన cases కూడా solve చేయొచ్చు. + +![Levenshtein distance](https://cdn-images-1.medium.com/max/2600/1*497gMaFErzJpCXG7kS_7dw.png) + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Levenshtein_distance) +- [YouTube](https://www.youtube.com/watch?v=We3YDTzNXEk&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) +- [ITNext](https://itnext.io/dynamic-programming-vs-divide-and-conquer-2fea680becbe) diff --git a/src/algorithms/string/longest-common-substring/README.md b/src/algorithms/string/longest-common-substring/README.md index 9e63294f04..96d6fce147 100644 --- a/src/algorithms/string/longest-common-substring/README.md +++ b/src/algorithms/string/longest-common-substring/README.md @@ -1,5 +1,8 @@ # Longest Common Substring Problem +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + The longest common substring problem is to find the longest string (or strings) that is a substring (or are substrings) of two or more strings. diff --git a/src/algorithms/string/longest-common-substring/README.tel-IN.md b/src/algorithms/string/longest-common-substring/README.tel-IN.md new file mode 100644 index 0000000000..d934ad008b --- /dev/null +++ b/src/algorithms/string/longest-common-substring/README.tel-IN.md @@ -0,0 +1,25 @@ +# Longest Common Substring Problem + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Longest common substring problem అంటే — రెండు లేదా అంతకంటే ఎక్కువ strings లో substring గా ఉండే +అతి పొడవైన string (లేదా strings) కనుక్కోవడం. + +## Example + +`ABABC`, `BABCA`, `ABCBA` strings యొక్క longest common substring `ABC`, దాని పొడవు 3. మిగతా common +substrings `A`, `AB`, `B`, `BA`, `BC`, `C`. + +``` +ABABC + ||| + BABCA + ||| + ABCBA +``` + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Longest_common_substring_problem) +- [YouTube](https://www.youtube.com/watch?v=BysNXJHzCEs&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/string/palindrome/README.md b/src/algorithms/string/palindrome/README.md index 0ce77d42b6..f384e4df18 100644 --- a/src/algorithms/string/palindrome/README.md +++ b/src/algorithms/string/palindrome/README.md @@ -1,5 +1,8 @@ # Palindrome Check +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + A [Palindrome](https://en.wikipedia.org/wiki/Palindrome) is a string that reads the same forwards and backwards. This means that the second half of the string is the reverse of the first half. diff --git a/src/algorithms/string/palindrome/README.tel-IN.md b/src/algorithms/string/palindrome/README.tel-IN.md new file mode 100644 index 0000000000..ecdfff8c65 --- /dev/null +++ b/src/algorithms/string/palindrome/README.tel-IN.md @@ -0,0 +1,31 @@ +# Palindrome Check + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +[Palindrome](https://en.wikipedia.org/wiki/Palindrome) అంటే ముందు నుంచి చదివినా, వెనక నుంచి చదివినా +ఒకేలా ఉండే string. అంటే string రెండో సగం, మొదటి సగాన్ని తిరగేస్తే వచ్చేదే. + +## Examples + +ఇవి palindromes (కాబట్టి `TRUE` return చేస్తాయి): + +``` +- "a" +- "pop" -> p + o + p +- "deed" -> de + ed +- "kayak" -> ka + y + ak +- "racecar" -> rac + e + car +``` + +ఇవి palindromes కావు (కాబట్టి `FALSE` return చేస్తాయి): + +``` +- "rad" +- "dodo" +- "polo" +``` + +## References + +- [GeeksForGeeks - ఒక నంబర్ Palindrome ఆ కాదా చెక్ చేయడం](https://www.geeksforgeeks.org/check-if-a-number-is-palindrome/) diff --git a/src/algorithms/string/rabin-karp/README.md b/src/algorithms/string/rabin-karp/README.md index c273b273db..bd7715364a 100644 --- a/src/algorithms/string/rabin-karp/README.md +++ b/src/algorithms/string/rabin-karp/README.md @@ -1,5 +1,8 @@ # Rabin Karp Algorithm +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + In computer science, the Rabin–Karp algorithm or Karp–Rabin algorithm is a string searching algorithm created by Richard M. Karp and Michael O. Rabin (1987) that uses hashing to find any one of a set diff --git a/src/algorithms/string/rabin-karp/README.tel-IN.md b/src/algorithms/string/rabin-karp/README.tel-IN.md new file mode 100644 index 0000000000..9ae2a62ed5 --- /dev/null +++ b/src/algorithms/string/rabin-karp/README.tel-IN.md @@ -0,0 +1,49 @@ +# Rabin Karp Algorithm + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Computer science లో Rabin–Karp algorithm (లేదా Karp–Rabin algorithm) అనేది Richard M. Karp, +Michael O. Rabin (1987) తయారుచేసిన string searching algorithm. ఒక text లో, కొన్ని pattern strings +లో ఏదైనా ఒకటి ఉందో లేదో కనుక్కోవడానికి ఇది hashing వాడుతుంది. + +## Algorithm + +Pattern కి, text లో ఉన్న substrings కి సమానమా అని test చేయడాన్ని hash function వాడి ఫాస్ట్ చేయడానికి +Rabin–Karp algorithm ట్రై చేస్తుంది. Hash function అంటే ప్రతి string ని ఒక numeric value గా +మార్చే function — ఆ value ని దాని hash value అంటారు; ఉదాహరణకి `hash('hello') = 5` అవ్వొచ్చు. +రెండు strings సమానం అయితే, వాటి hash values కూడా సమానం అనే విషయాన్ని ఈ algorithm వాడుకుంటుంది. +కాబట్టి string matching అంటే (దాదాపు) — search pattern hash value లెక్కపెట్టి, input string లో అదే hash +value ఉన్న substrings కోసం వెతకడం. + +కానీ, ఈ పద్ధతిలో రెండు problems ఉన్నాయి. మొదటిది, strings చాలా ఎక్కువ, hash values చాలా తక్కువ +కాబట్టి, కొన్ని వేరువేరు strings కి ఒకే hash value రావొచ్చు. Hash values match అయినా, pattern, substring +match అవ్వకపోవచ్చు; కాబట్టి search pattern, substring match అయ్యాయి అనిపిస్తే, వాటిని compare చేసి +కన్ఫర్మ్ చేయాలి; పొడవైన substrings కి ఆ compare కి చాలా టైమ్ పట్టొచ్చు. అదృష్టం ఏంటంటే, మామూలు +strings మీద మంచి hash function కి మామూలుగా ఎక్కువ collisions రావు, కాబట్టి search టైమ్ సరిపోయేంతగానే +ఉంటుంది. + +## వాడిన Hash Function + +Rabin–Karp algorithm performance కి ముఖ్యమైన విషయం — text లో వరుసగా వచ్చే substrings hash values ని +ఫాస్ట్ గా లెక్కపెట్టడం. **Rabin fingerprint** అనేది బాగా పాపులర్ అయిన, బాగా పనిచేసే rolling hash function. + +ఈ example లో చెప్పిన **polynomial hash function** Rabin fingerprint కాదు, కానీ అది కూడా అంతే బాగా +పనిచేస్తుంది. ఇది ప్రతి substring ని ఏదో ఒక base లో ఒక నంబర్ గా చూస్తుంది — ఆ base మామూలుగా ఒక పెద్ద prime. + +## Complexity + +`n` పొడవు ఉన్న text కి, మొత్తం పొడవు `m` ఉన్న `p` patterns కి, దీని average, best case running time +`O(n + m)`, space `O(p)`, కానీ worst-case time `O(n * m)`. + +## ఎక్కడ వాడతారు + +ఈ algorithm ని practical గా వాడే ఒక చోటు — plagiarism (కాపీ కొట్టడం) పట్టుకోవడం. Source material ఇస్తే, +ఈ algorithm ఒక paper లో source material నుంచి వచ్చిన sentences ఉన్నాయా అని ఫాస్ట్ గా వెతుకుతుంది — +case (capital/small letters), punctuation లాంటి details ని పట్టించుకోకుండా. వెతకాల్సిన strings చాలా +ఎక్కువ ఉంటాయి కాబట్టి, ఒక్కో string వెతికే algorithms ఇక్కడ పనికిరావు. + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm) +- [YouTube](https://www.youtube.com/watch?v=H4VrKHVG5qI&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/algorithms/string/regular-expression-matching/README.md b/src/algorithms/string/regular-expression-matching/README.md index e04c071e40..b8084019c6 100644 --- a/src/algorithms/string/regular-expression-matching/README.md +++ b/src/algorithms/string/regular-expression-matching/README.md @@ -1,5 +1,8 @@ # Regular Expression Matching +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + Given an input string `s` and a pattern `p`, implement regular expression matching with support for `.` and `*`. diff --git a/src/algorithms/string/regular-expression-matching/README.tel-IN.md b/src/algorithms/string/regular-expression-matching/README.tel-IN.md new file mode 100644 index 0000000000..cee1fe4db4 --- /dev/null +++ b/src/algorithms/string/regular-expression-matching/README.tel-IN.md @@ -0,0 +1,74 @@ +# Regular Expression Matching + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Input string `s`, pattern `p` ఇస్తే, `.`, `*` కి support ఉన్న regular expression matching ని implement చేయాలి. + +- `.` ఏ ఒక్క character కైనా match అవుతుంది. +- `*` దాని ముందు ఉన్న element zero లేదా అంతకంటే ఎక్కువసార్లు ఉంటే match అవుతుంది. + +Matching అనేది input string **మొత్తాన్ని** cover చేయాలి (కొంత భాగం కాదు). + +**Note** + +- `s` ఖాళీగా ఉండొచ్చు, అందులో `a-z` small letters మాత్రమే ఉంటాయి. +- `p` ఖాళీగా ఉండొచ్చు, అందులో `a-z` small letters, ఇంకా `.` లేదా `*` లాంటి characters మాత్రమే ఉంటాయి. + +## Examples + +**Example #1** + +Input: +``` +s = 'aa' +p = 'a' +``` + +Output: `false` + +Explanation: `a` అనేది string `aa` మొత్తానికి match అవ్వదు. + +**Example #2** + +Input: +``` +s = 'aa' +p = 'a*' +``` + +Output: `true` + +Explanation: `*` అంటే దాని ముందు ఉన్న element `a` zero లేదా అంతకంటే ఎక్కువసార్లు అని. +కాబట్టి `a` ని ఒకసారి రిపీట్ చేస్తే, అది `aa` అవుతుంది. + +**Example #3** + +Input: + +``` +s = 'ab' +p = '.*' +``` + +Output: `true` + +Explanation: `.*` అంటే "ఏ character (`.`) అయినా zero లేదా అంతకంటే ఎక్కువసార్లు (`*`)" అని. + +**Example #4** + +Input: + +``` +s = 'aab' +p = 'c*a*b' +``` + +Output: `true` + +Explanation: `c` ని 0 సార్లు, `a` ని 1 సారి రిపీట్ చేయొచ్చు. కాబట్టి ఇది `aab` కి match అవుతుంది. + +## References + +- [YouTube](https://www.youtube.com/watch?v=l3hda49XcDE&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&index=71&t=0s) +- [LeetCode](https://leetcode.com/problems/regular-expression-matching/description/) diff --git a/src/algorithms/string/z-algorithm/README.md b/src/algorithms/string/z-algorithm/README.md index 0f12bc7333..eb5c0bf0f0 100644 --- a/src/algorithms/string/z-algorithm/README.md +++ b/src/algorithms/string/z-algorithm/README.md @@ -1,5 +1,8 @@ # Z Algorithm +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + The Z-algorithm finds occurrences of a "word" `W` within a main "text string" `T` in linear time `O(|W| + |T|)`. diff --git a/src/algorithms/string/z-algorithm/README.tel-IN.md b/src/algorithms/string/z-algorithm/README.tel-IN.md new file mode 100644 index 0000000000..543b0cb01c --- /dev/null +++ b/src/algorithms/string/z-algorithm/README.tel-IN.md @@ -0,0 +1,60 @@ +# Z Algorithm + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Z-algorithm ఒక main "text string" `T` లో "word" `W` ఎక్కడెక్కడ ఉందో linear time `O(|W| + |T|)` లో +కనుక్కుంటుంది. + +`n` పొడవు ఉన్న string `S` ఇస్తే, ఈ algorithm ఒక array `Z` తయారుచేస్తుంది — ఇక్కడ `Z[i]` అంటే +`S[i]` నుంచి మొదలయ్యే, `S` కి prefix కూడా అయిన అతి పొడవైన substring. Word `W`, ఒక ప్రత్యేక character +(ఉదాహరణకి `$`), తర్వాత text `T` — ఇవన్నీ కలిపి వచ్చే string కి `Z` కనుక్కుంటే pattern matching కి +ఉపయోగపడుతుంది — ఎందుకంటే ఏదైనా index `i` దగ్గర `Z[i]` pattern పొడవుకి సమానం అయితే, ఆ point దగ్గర +pattern ఉన్నట్టే. + +`Z` array ని రెండు nested loops తో `O(|W| * |T|)` టైమ్ లో లెక్కపెట్టొచ్చు, కానీ కింద ఉన్న పద్ధతి దాన్ని +linear time లో ఎలా తెచ్చుకోవాలో చూపిస్తుంది. ఐడియా ఏంటంటే — string లో letters మీద iterate చేస్తూ +(index `i` ని `1` నుంచి `n - 1` వరకు), ఒక interval `[L, R]` ని maintain చేస్తాం. అది `1 ≤ L ≤ i ≤ R` +అయ్యేలా, `S[L...R]` అనేది prefix గానూ substring గానూ ఉండేలా, maximum `R` ఉన్న interval (అలాంటి +interval లేకపోతే, `L = R = - 1` పెట్టేయండి). `i = 1` కి, `S[0...]` ని `S[1...]` తో compare చేసి +`L`, `R` ని సింపుల్ గా లెక్కపెట్టొచ్చు. + +**Z array example** + +``` +Index 0 1 2 3 4 5 6 7 8 9 10 11 +Text a a b c a a b x a a a z +Z values X 1 0 0 3 1 0 0 2 2 1 0 +``` + +ఇంకొన్ని examples + +``` +str = a a a a a a +Z[] = x 5 4 3 2 1 +``` + +``` +str = a a b a a c d +Z[] = x 1 0 2 1 0 0 +``` + +``` +str = a b a b a b a b +Z[] = x 0 6 0 4 0 2 0 +``` + +**Z box example** + +![z-box](https://ivanyu.me/wp-content/uploads/2014/09/zalg1.png) + +## Complexity + +- **Time:** `O(|W| + |T|)` +- **Space:** `O(|W|)` + +## References + +- [GeeksForGeeks](https://www.geeksforgeeks.org/z-algorithm-linear-time-pattern-searching-algorithm/) +- [YouTube](https://www.youtube.com/watch?v=CpZh4eF8QBw&t=0s&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&index=70) +- [Ivan Yurchenko రాసిన Z Algorithm](https://ivanyu.me/blog/2013/10/15/z-algorithm/) diff --git a/src/algorithms/tree/breadth-first-search/README.md b/src/algorithms/tree/breadth-first-search/README.md index fe31217ae5..6cd1b6ab2d 100644 --- a/src/algorithms/tree/breadth-first-search/README.md +++ b/src/algorithms/tree/breadth-first-search/README.md @@ -1,5 +1,8 @@ # Breadth-First Search (BFS) +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + Breadth-first search (BFS) is an algorithm for traversing or searching tree or graph data structures. It starts at the tree root (or some arbitrary node of a graph, sometimes diff --git a/src/algorithms/tree/breadth-first-search/README.tel-IN.md b/src/algorithms/tree/breadth-first-search/README.tel-IN.md new file mode 100644 index 0000000000..b7a2289f35 --- /dev/null +++ b/src/algorithms/tree/breadth-first-search/README.tel-IN.md @@ -0,0 +1,41 @@ +# Breadth-First Search (BFS) + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Breadth-first search (BFS) అనేది tree లేదా graph data structures ని traverse చేయడానికి, search +చేయడానికి వాడే algorithm. ఇది tree root నుంచి (graph అయితే ఏదో ఒక node నుంచి — దాన్ని కొన్నిసార్లు +'search key' అంటారు) మొదలుపెట్టి, ముందు పక్కనే ఉన్న neighbor nodes అన్నీ చూస్తుంది, ఆ తర్వాతే next +level neighbors దగ్గరికి వెళ్తుంది. + +![Algorithm Visualization](https://upload.wikimedia.org/wikipedia/commons/5/5d/Breadth-First-Search-Algorithm.gif) + +## Pseudocode + +```text +BFS(root) + Pre: root is the node of the BST + Post: the nodes in the BST have been visited in breadth first order + q ← queue + while root = ø + yield root.value + if root.left = ø + q.enqueue(root.left) + end if + if root.right = ø + q.enqueue(root.right) + end if + if !q.isEmpty() + root ← q.dequeue() + else + root ← ø + end if + end while +end BFS +``` + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Breadth-first_search) +- [Tree Traversals (Inorder, Preorder and Postorder)](https://www.geeksforgeeks.org/tree-traversals-inorder-preorder-and-postorder/) +- [BFS vs DFS](https://www.geeksforgeeks.org/bfs-vs-dfs-binary-tree/) diff --git a/src/algorithms/tree/depth-first-search/README.md b/src/algorithms/tree/depth-first-search/README.md index 30f22ee7fd..4c153c19d1 100644 --- a/src/algorithms/tree/depth-first-search/README.md +++ b/src/algorithms/tree/depth-first-search/README.md @@ -1,5 +1,8 @@ # Depth-First Search (DFS) +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. One starts at the root (selecting some arbitrary node as the root in diff --git a/src/algorithms/tree/depth-first-search/README.tel-IN.md b/src/algorithms/tree/depth-first-search/README.tel-IN.md new file mode 100644 index 0000000000..abe490b105 --- /dev/null +++ b/src/algorithms/tree/depth-first-search/README.tel-IN.md @@ -0,0 +1,16 @@ +# Depth-First Search (DFS) + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Depth-first search (DFS) అనేది tree లేదా graph data structures ని traverse చేయడానికి, search +చేయడానికి వాడే algorithm. Root నుంచి మొదలుపెడతాం (graph అయితే ఏదో ఒక node ని root గా తీసుకుంటాం), +ప్రతి branch లో వీలైనంత లోతుకి వెళ్ళి, ఇక ముందుకి దారి లేనప్పుడే వెనక్కి (backtrack) వస్తాం. + +![Algorithm Visualization](https://upload.wikimedia.org/wikipedia/commons/7/7f/Depth-First-Search.gif) + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Depth-first_search) +- [Tree Traversals (Inorder, Preorder and Postorder)](https://www.geeksforgeeks.org/tree-traversals-inorder-preorder-and-postorder/) +- [BFS vs DFS](https://www.geeksforgeeks.org/bfs-vs-dfs-binary-tree/) diff --git a/src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.md b/src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.md index 975eade3a4..1b51f827aa 100644 --- a/src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.md +++ b/src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.md @@ -1,5 +1,8 @@ # Best Time to Buy and Sell Stock +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + ## Task Description Say you have an array prices for which the `i`-th element is the price of a given stock on day `i`. diff --git a/src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.tel-IN.md b/src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.tel-IN.md new file mode 100644 index 0000000000..961ca26973 --- /dev/null +++ b/src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.tel-IN.md @@ -0,0 +1,110 @@ +# Best Time to Buy and Sell Stock + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +## Task Description + +మీ దగ్గర prices అనే array ఉంది అనుకోండి — అందులో `i`-th element అంటే రోజు `i` న ఒక stock price. + +Maximum profit కనుక్కోండి. ఎన్ని transactions అయినా చేయొచ్చు (అంటే stock లో ఒక share ని చాలాసార్లు కొని, అమ్మొచ్చు). + +> Note: ఒకేసారి చాలా transactions చేయకూడదు (అంటే మళ్ళీ కొనే ముందు stock అమ్మేయాలి). + +**Example #1** + +``` +Input: [7, 1, 5, 3, 6, 4] +Output: 7 +``` + +_Explanation:_ రోజు `2` న కొనండి (`price = 1`), రోజు `3` న అమ్మండి (`price = 5`), `profit = 5-1 = 4`. తర్వాత రోజు `4` న కొనండి (`price = 3`), రోజు `5` న అమ్మండి (`price = 6`), `profit = 6-3 = 3`. + +**Example #2** + +``` +Input: [1, 2, 3, 4, 5] +Output: 4 +``` + +_Explanation:_ రోజు `1` న కొనండి (`price = 1`), రోజు `5` న అమ్మండి (`price = 5`), `profit = 5-1 = 4`. గమనించండి — రోజు 1 న కొని, రోజు 2 న మళ్ళీ కొని, తర్వాత అమ్మడం కుదరదు, ఎందుకంటే అలా చేస్తే ఒకేసారి చాలా transactions చేసినట్టు. మళ్ళీ కొనే ముందు అమ్మేయాలి. + +**Example #3** + +``` +Input: [7, 6, 4, 3, 1] +Output: 0 +``` + +_Explanation:_ ఈ case లో ఏ transaction చేయము, అంటే max `profit = 0`. + +## Possible Solutions + +### Divide and conquer approach `O(2^n)` + +కొనడం, అమ్మడం యొక్క **అన్ని** combinations ట్రై చేసి, _divide and conquer approach_ వాడి ఎక్కువ profit వచ్చేది కనుక్కోవచ్చు. + +మన దగ్గర prices array `[7, 6, 4, 3, 1]` ఉంది, మనం trading లో _1st_ రోజు (array మొదట్లో) ఉన్నాం అనుకుందాం. ఈ point దగ్గర మొత్తం maximum profit అంటే ఈ రెండు values లో _maximum_ అని చెప్పొచ్చు: + +1. _Option 1: డబ్బు దగ్గరే ఉంచుకోవడం_ → profit అంటే మిగతా stocks కొని/అమ్మితే వచ్చే profit → `keepProfit = profit([6, 4, 3, 1])`. +2. _Option 2: ఇప్పటి price కి కొనడం/అమ్మడం_ → ఈ case లో profit అంటే మిగతా stocks కొని/అమ్మితే వచ్చే profit కి ఇప్పటి stock price కలపడం (లేదా తీసేయడం, అమ్ముతున్నామా కొంటున్నామా అనేదాన్ని బట్టి) → `buySellProfit = -7 + profit([6, 4, 3, 1])`. + +మొత్తం profit → `overallProfit = Max(keepProfit, buySellProfit)`. + +చూడొచ్చు — `profit([6, 4, 3, 1])` task ని కూడా ఇదే recursive పద్ధతిలో solve చేస్తాం. + +> పూర్తి code example కోసం [dqBestTimeToBuySellStocks.js](dqBestTimeToBuySellStocks.js) చూడండి + +#### Time Complexity + +చూడొచ్చు — ప్రతి recursive call ఇంకో _2_ recursive branches తయారుచేస్తుంది. Recursion లోతు `n` (prices array సైజ్) ఉంటుంది, కాబట్టి time complexity `O(2^n)`. + +చూడొచ్చు, ఇది చాలా inefficient. ఉదాహరణకి కేవలం `20` prices కే recursive calls దాదాపు `2M` (20 లక్షలు) దగ్గర ఉంటాయి! + +#### Additional Space Complexity + +Recursive function calls మధ్య prices array ని clone చేయకుండా, array pointer వాడితే — additional space complexity recursion లోతుకి proportional గా ఉంటుంది: `O(n)` + +## Peak Valley Approach `O(n)` + +Prices array (అంటే `[7, 1, 5, 3, 6, 4]`) ని graph గా గీస్తే, ముఖ్యమైన points అంటే వరుసగా వచ్చే లోయలు (valleys), శిఖరాలు (peaks) అని గమనించొచ్చు + +![Peak Valley Approach](https://leetcode.com/media/original_images/122_maxprofit_1.PNG) + +_Image source: [LeetCode](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/solution/)_ + +కాబట్టి, పెరుగుతున్న price ని ట్రాక్ చేస్తూ, price తగ్గే _ముందే_ వెంటనే stocks అమ్మేస్తే maximum profit వస్తుంది (గుర్తుపెట్టుకోండి, stock ని లోయలో తక్కువ price కి కొన్నాం). + +> పూర్తి code example కోసం [peakvalleyBestTimeToBuySellStocks.js](peakvalleyBestTimeToBuySellStocks.js) చూడండి + +#### Time Complexity + +Algorithm prices array మీద ఒక్కసారి వెళ్తే చాలు కాబట్టి, time complexity `O(n)`. + +#### Additional Space Complexity + +Prices array కాకుండా algorithm constant memory మాత్రమే వాడుతుంది. కాబట్టి, additional space complexity `O(1)`. + +## Accumulator Approach `O(n)` + +ఇంకా సింపుల్ పద్ధతి కూడా ఉంది. మన దగ్గర prices array `[1, 7, 2, 3, 6, 7, 6, 7]` ఇలా ఉంది అనుకుందాం: + +![Simple One Pass](https://leetcode.com/media/original_images/122_maxprofit_2.PNG) + +_Image source: [LeetCode](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/solution/)_ + +గమనించొచ్చు — నిరంతరం పెరుగుతున్న price ని ట్రాక్ చేయాల్సిన అవసరం కూడా లేదు. బదులుగా, chart లో _పెరుగుతున్న అన్ని భాగాల_ price తేడాని కలుపుతూ వెళ్తే చాలు — చివరికి అదే వీలైనంత ఎక్కువ profit, + +> పూర్తి code example కోసం [accumulatorBestTimeToBuySellStocks.js](accumulatorBestTimeToBuySellStocks.js) చూడండి + +#### Time Complexity + +Algorithm prices array మీద ఒక్కసారి వెళ్తే చాలు కాబట్టి, time complexity `O(n)`. + +#### Additional Space Complexity + +Prices array కాకుండా algorithm constant memory మాత్రమే వాడుతుంది. కాబట్టి, additional space complexity `O(1)`. + +## References + +- [LeetCode లో Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/) diff --git a/src/algorithms/uncategorized/hanoi-tower/README.md b/src/algorithms/uncategorized/hanoi-tower/README.md index 816df8d3d6..77e6be529d 100644 --- a/src/algorithms/uncategorized/hanoi-tower/README.md +++ b/src/algorithms/uncategorized/hanoi-tower/README.md @@ -1,5 +1,8 @@ # Tower of Hanoi +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + The Tower of Hanoi (also called the Tower of Brahma or Lucas' Tower and sometimes pluralized) is a mathematical game or puzzle. It consists of three rods and a number of disks of different sizes, diff --git a/src/algorithms/uncategorized/hanoi-tower/README.tel-IN.md b/src/algorithms/uncategorized/hanoi-tower/README.tel-IN.md new file mode 100644 index 0000000000..7292a8d44f --- /dev/null +++ b/src/algorithms/uncategorized/hanoi-tower/README.tel-IN.md @@ -0,0 +1,27 @@ +# Tower of Hanoi + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Tower of Hanoi (దీన్నే Tower of Brahma లేదా Lucas' Tower అని కూడా అంటారు) అనేది ఒక mathematical +game లేదా puzzle. ఇందులో మూడు కడ్డీలు (rods), వేరువేరు సైజ్ లో ఉన్న కొన్ని disks ఉంటాయి — ఆ disks ని +ఏ కడ్డీలోనైనా వేయొచ్చు. Puzzle మొదట్లో disks అన్నీ ఒక కడ్డీలో సైజ్ వరుసలో నీట్ గా పేర్చి ఉంటాయి — +అన్నిటికంటే చిన్నది పైన, అలా ఒక cone (శంఖువు) షేప్ లో. + +Puzzle లక్ష్యం ఏంటంటే, ఈ సింపుల్ rules పాటిస్తూ మొత్తం stack ని ఇంకో కడ్డీకి జరపాలి: + +- ఒకసారి ఒక్క disk మాత్రమే జరపాలి. +- ప్రతి move లో, ఏదో ఒక stack నుంచి పై disk తీసి, ఇంకో stack పైన గానీ ఖాళీ కడ్డీ మీద గానీ పెట్టాలి. +- ఏ disk ని కూడా దానికంటే చిన్న disk మీద పెట్టకూడదు. + +![Hanoi Tower](https://upload.wikimedia.org/wikipedia/commons/8/8d/Iterative_algorithm_solving_a_6_disks_Tower_of_Hanoi.gif) + +6-disk problem ని solve చేసే iterative algorithm animation + +`3` disks ఉంటే, puzzle ని `7` moves లో solve చేయొచ్చు. Tower of Hanoi puzzle solve చేయడానికి కావాల్సిన +కనీస moves `2^n − 1`, ఇక్కడ `n` అంటే disks సంఖ్య. + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Tower_of_Hanoi) +- [HackerEarth](https://www.hackerearth.com/blog/algorithms/tower-hanoi-recursion-game-algorithm-explained/) diff --git a/src/algorithms/uncategorized/jump-game/README.md b/src/algorithms/uncategorized/jump-game/README.md index fc8c713e3e..1abfc83936 100644 --- a/src/algorithms/uncategorized/jump-game/README.md +++ b/src/algorithms/uncategorized/jump-game/README.md @@ -1,5 +1,8 @@ # Jump Game +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + ## The Problem Given an array of non-negative integers, you are initially positioned at diff --git a/src/algorithms/uncategorized/jump-game/README.tel-IN.md b/src/algorithms/uncategorized/jump-game/README.tel-IN.md new file mode 100644 index 0000000000..21dfc7bee5 --- /dev/null +++ b/src/algorithms/uncategorized/jump-game/README.tel-IN.md @@ -0,0 +1,115 @@ +# Jump Game + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +## Problem + +Negative కాని integers ఉన్న ఒక array ఇస్తారు, మొదట్లో మీరు array లో మొదటి index దగ్గర ఉంటారు. +Array లో ప్రతి element అంటే ఆ position నుంచి మీరు దూకగలిగే maximum దూరం. + +మీరు చివరి index కి చేరగలరా లేదా నిర్ణయించండి. + +**Example #1** + +``` +Input: [2,3,1,1,4] +Output: true +Explanation: Jump 1 step from index 0 to 1, then 3 steps to the last index. +``` + +(Index 0 నుంచి 1 కి 1 step దూకి, తర్వాత 3 steps దూకితే చివరి index వస్తుంది.) + +**Example #2** + +``` +Input: [3,2,1,0,4] +Output: false +Explanation: You will always arrive at index 3 no matter what. Its maximum + jump length is 0, which makes it impossible to reach the last index. +``` + +(ఏం చేసినా మీరు index 3 దగ్గరికే వస్తారు. దాని maximum jump దూరం 0, కాబట్టి చివరి index కి చేరడం కుదరదు.) + +## పేర్లు + +Array లో ఒక position నుంచి మొదలుపెట్టి చివరి index కి చేరగలిగితే, ఆ position ని **"good index"** అంటాం. +లేకపోతే, ఆ index ని **"bad index"** అంటాం. అప్పుడు problem అంటే — index 0 "good index" ఆ కాదా అని తేల్చడమే. + +## Solutions + +### Approach 1: Backtracking + +ఇది inefficient solution — మొదటి position నుంచి చివరి position కి తీసుకెళ్ళే ప్రతి jump pattern ని +ట్రై చేస్తాం. మొదటి position నుంచి మొదలుపెట్టి, చేరగలిగే ప్రతి index కి దూకుతాం. చివరి index వచ్చేదాకా +ఇదే మళ్ళీ మళ్ళీ చేస్తాం. ఇరుక్కుపోతే, వెనక్కి (backtrack) వస్తాం. + +> [backtrackingJumpGame.js](backtrackingJumpGame.js) file చూడండి + +**Time complexity:**: `O(2^n)`. +మొదటి position నుంచి చివరి position కి దూకడానికి 2n (upper bound) పద్ధతులు ఉన్నాయి, +ఇక్కడ `n` అంటే array `nums` పొడవు. + +**Auxiliary Space Complexity**: `O(n)`. +Recursion కి stack frames కోసం అదనపు memory కావాలి. + +### Approach 2: Dynamic Programming Top-down + +Top-down Dynamic Programming ని optimize చేసిన backtracking గా అనుకోవచ్చు. ఇది ఒక విషయం మీద +ఆధారపడుతుంది — ఒక index good / bad అని ఒకసారి తేలిపోతే, ఆ result ఇక ఎప్పటికీ మారదు. అంటే ఆ result +ని store చేసుకోవచ్చు, ప్రతిసారి మళ్ళీ లెక్కపెట్టాల్సిన అవసరం లేదు. + +కాబట్టి, array లో ప్రతి position కి, ఆ index good ఆ bad ఆ అని గుర్తుపెట్టుకుంటాం. ఈ array ని memo +అందాం, దాని values GOOD, BAD, UNKNOWN లో ఏదో ఒకటి. ఈ technique ని memoization అంటారు. + +> [dpTopDownJumpGame.js](dpTopDownJumpGame.js) file చూడండి + +**Time complexity:**: `O(n^2)`. +Array లో ప్రతి element `i` కి, GOOD index కనుక్కోవడానికి దాని కుడి వైపు ఉన్న next `nums[i]` elements +చూస్తాం. `nums[i]` మహా అయితే `n` ఉండొచ్చు, ఇక్కడ `n` అంటే array `nums` పొడవు. + +**Auxiliary Space Complexity**: `O(2 * n) = O(n)`. +మొదటి `n` recursion నుంచి వస్తుంది. రెండో `n` memo table వాడటం వల్ల వస్తుంది. + +### Approach 3: Dynamic Programming Bottom-up + +Recursion తీసేసి top-down ని bottom-up గా మారుస్తాం. Practical గా, దీంతో performance బెటర్ అవుతుంది — +ఎందుకంటే method stack overhead ఉండదు, ఇంకా caching వల్ల కూడా లాభం రావొచ్చు. ఇంకా ముఖ్యంగా, ఈ step +తర్వాత ఇంకా optimize చేసే అవకాశాలు తెరుస్తుంది. మామూలుగా top-down approach లో steps order ని +తిరగేసి recursion తీసేస్తారు. + +ఇక్కడ గమనించాల్సింది ఏంటంటే — మనం ఎప్పుడూ కుడి వైపుకే దూకుతాం. అంటే array కుడి వైపు నుంచి +మొదలుపెడితే, ప్రతిసారి మన కుడి వైపు ఉన్న position గురించి అడిగినప్పుడు, ఆ position GOOD ఆ BAD ఆ అనేది +ఇప్పటికే తేలిపోయి ఉంటుంది. అంటే ఇక recursion అవసరం లేదు, ఎప్పుడూ memo table లోనే answer దొరుకుతుంది. + +> [dpBottomUpJumpGame.js](dpBottomUpJumpGame.js) file చూడండి + +**Time complexity:**: `O(n^2)`. +Array లో ప్రతి element `i` కి, GOOD index కనుక్కోవడానికి దాని కుడి వైపు ఉన్న next `nums[i]` elements +చూస్తాం. `nums[i]` మహా అయితే `n` ఉండొచ్చు, ఇక్కడ `n` అంటే array `nums` పొడవు. + +**Auxiliary Space Complexity**: `O(n)`. +ఇది memo table వాడటం వల్ల వస్తుంది. + +### Approach 4: Greedy + +Code bottom-up లోకి వచ్చాక, చివరిగా ఒక ముఖ్యమైన విషయం గమనించొచ్చు. ఒక position నుంచి GOOD position +కి దూకగలమా అని చూసేటప్పుడు, మనం ఎప్పుడూ ఒక్కటే వాడతాం — మొదటిది. అంటే, అన్నిటికంటే ఎడమ వైపు +ఉన్నది. ఈ ఎడమ వైపు GOOD position ని ఒక సెపరేట్ variable లో ట్రాక్ చేస్తే, దాని కోసం array లో వెతకాల్సిన +అవసరం ఉండదు. అంతే కాదు, అసలు array వాడటమే ఆపేయొచ్చు. + +> [greedyJumpGame.js](greedyJumpGame.js) file చూడండి + +**Time complexity:**: `O(n)`. +`nums` array మీద ఒక్కసారి మాత్రమే వెళ్తాం, కాబట్టి `n` steps, ఇక్కడ `n` అంటే array `nums` పొడవు. + +**Auxiliary Space Complexity**: `O(1)`. +ఏ అదనపు memory వాడట్లేదు. + +## References + +- [LeetCode లో Jump Game పూర్తి వివరణ](https://leetcode.com/articles/jump-game/) +- [Dynamic Programming vs Divide and Conquer](https://itnext.io/dynamic-programming-vs-divide-and-conquer-2fea680becbe) +- [Dynamic Programming](https://en.wikipedia.org/wiki/Dynamic_programming) +- [Wikipedia లో Memoization](https://en.wikipedia.org/wiki/Memoization) +- [Wikipedia లో Top-Down and Bottom-Up Design](https://en.wikipedia.org/wiki/Top-down_and_bottom-up_design) diff --git a/src/algorithms/uncategorized/knight-tour/README.md b/src/algorithms/uncategorized/knight-tour/README.md index 6696b307fb..1ab0738744 100644 --- a/src/algorithms/uncategorized/knight-tour/README.md +++ b/src/algorithms/uncategorized/knight-tour/README.md @@ -1,5 +1,8 @@ # Knight's Tour +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + A **knight's tour** is a sequence of moves of a knight on a chessboard such that the knight visits every square only once. If the knight ends on a square that is one knight's move from the beginning diff --git a/src/algorithms/uncategorized/knight-tour/README.tel-IN.md b/src/algorithms/uncategorized/knight-tour/README.tel-IN.md new file mode 100644 index 0000000000..de4938a760 --- /dev/null +++ b/src/algorithms/uncategorized/knight-tour/README.tel-IN.md @@ -0,0 +1,29 @@ +# Knight's Tour + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +**Knight's tour** అంటే chessboard మీద knight (గుర్రం) వేసే moves వరుస — అందులో knight ప్రతి square ని +ఒక్కసారి మాత్రమే visit చేస్తుంది. మొదలుపెట్టిన square నుంచి ఒక్క knight move దూరంలో ఉన్న square +దగ్గర knight ముగిస్తే (అంటే అదే దారిలో వెంటనే మళ్ళీ board మొత్తం తిరగగలిగేలా), ఆ tour **closed**, +లేకపోతే అది **open**. + +**Knight's tour problem** అంటే knight's tour కనుక్కునే mathematical problem. Knight's tour కనుక్కునే +program రాయడం computer science students కి ఇచ్చే common problem. Knight's tour problem లో variations +అంటే — మామూలు `8×8` కాకుండా వేరే సైజ్ chessboards, ఇంకా irregular (దీర్ఘచతురస్రం కాని) boards. + +Knight's tour problem అనేది graph theory లో ఇంకా జనరల్ అయిన **Hamiltonian path problem** కి ఒక +ఉదాహరణ. అలాగే closed knight's tour కనుక్కునే problem, Hamiltonian cycle problem కి ఒక ఉదాహరణ. + +![Knight's Tour](https://upload.wikimedia.org/wikipedia/commons/d/da/Knight%27s_tour_anim_2.gif) + +Chessboard మీద ఒక open knight's tour. + +![Knight's Tour](https://upload.wikimedia.org/wikipedia/commons/c/ca/Knights-Tour-Animation.gif) + +5 by 5 board మీద ఒక open knight's tour animation. + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Knight%27s_tour) +- [GeeksForGeeks](https://www.geeksforgeeks.org/backtracking-set-1-the-knights-tour-problem/) diff --git a/src/algorithms/uncategorized/n-queens/README.md b/src/algorithms/uncategorized/n-queens/README.md index 399256768e..6753f60d11 100644 --- a/src/algorithms/uncategorized/n-queens/README.md +++ b/src/algorithms/uncategorized/n-queens/README.md @@ -1,5 +1,8 @@ # N-Queens Problem +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + The **eight queens puzzle** is the problem of placing eight chess queens on an `8×8` chessboard so that no two queens threaten each other. Thus, a solution requires that no two queens share the same row, diff --git a/src/algorithms/uncategorized/n-queens/README.tel-IN.md b/src/algorithms/uncategorized/n-queens/README.tel-IN.md new file mode 100644 index 0000000000..94a9f72582 --- /dev/null +++ b/src/algorithms/uncategorized/n-queens/README.tel-IN.md @@ -0,0 +1,112 @@ +# N-Queens Problem + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +**Eight queens puzzle** అంటే `8×8` chessboard మీద ఎనిమిది chess queens ని పెట్టాలి — ఏ రెండు queens +ఒకదాన్నొకటి బెదిరించకూడదు (attack చేయకూడదు). కాబట్టి solution లో ఏ రెండు queens ఒకే row, column, +లేదా diagonal లో ఉండకూడదు. Eight queens puzzle అనేది ఇంకా జనరల్ అయిన *n queens problem* కి ఒక +ఉదాహరణ — `n×n` chessboard మీద ఒకదాన్నొకటి attack చేయని n queens ని పెట్టడం. `n=2`, `n=3` తప్ప +అన్ని natural numbers `n` కి solutions ఉన్నాయి. + +ఉదాహరణకి, 4 Queen problem కి ఒక solution ఇది. + +![N Queens](https://cdncontribute.geeksforgeeks.org/wp-content/uploads/N_Queen_Problem.jpg) + +Output గా ఒక binary matrix రావాలి — queens పెట్టిన blocks లో 1s ఉంటాయి. ఉదాహరణకి పైన 4 queen +solution కి output matrix ఇది. + +``` +{ 0, 1, 0, 0} +{ 0, 0, 0, 1} +{ 1, 0, 0, 0} +{ 0, 0, 1, 0} +``` + +## Naive Algorithm + +Board మీద queens తో వచ్చే అన్ని possible configurations తయారుచేసి, ఇచ్చిన conditions కి సరిపోయే +configuration ని print చేయండి. + +``` +while there are untried configurations +{ + generate the next configuration + if queens don't attack in this configuration then + { + print this configuration; + } +} +``` + +## Backtracking Algorithm + +ఐడియా ఏంటంటే — అన్నిటికంటే ఎడమ column నుంచి మొదలుపెట్టి, వేరువేరు columns లో queens ని ఒక్కొక్కటిగా +పెట్టడం. ఒక column లో queen పెట్టేటప్పుడు, ఇప్పటికే పెట్టిన queens తో గొడవ (clash) ఉందా అని చెక్ చేస్తాం. +ఇప్పటి column లో, clash లేని row దొరికితే, ఆ row, column ని solution లో భాగంగా mark చేస్తాం. Clashes +వల్ల అలాంటి row దొరకకపోతే, వెనక్కి (backtrack) వచ్చి false return చేస్తాం. + +``` +1) Start in the leftmost column +2) If all queens are placed + return true +3) Try all rows in the current column. Do following for every tried row. + a) If the queen can be placed safely in this row then mark this [row, + column] as part of the solution and recursively check if placing + queen here leads to a solution. + b) If placing queen in [row, column] leads to a solution then return + true. + 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. +3) If all rows have been tried and nothing worked, return false to trigger + backtracking. +``` + +(పైన steps సింపుల్ గా: 1) ఎడమ column నుంచి మొదలుపెట్టండి. 2) అన్ని queens పెట్టేస్తే true return చేయండి. +3) ఇప్పటి column లో అన్ని rows ట్రై చేయండి — queen ని ఆ row లో safe గా పెట్టగలిగితే ఆ [row, column] ని +mark చేసి, ఇక్కడ పెడితే solution వస్తుందా అని recursive గా చెక్ చేయండి; వస్తే true return చేయండి; రాకపోతే +ఆ [row, column] ని unmark చేసి (Backtrack) వేరే rows ట్రై చేయండి. అన్ని rows ట్రై చేసినా ఏదీ పనిచేయకపోతే, +backtracking కోసం false return చేయండి.) + +## Bitwise Solution + +Bitwise algorithm బేసిక్ గా problem ని ఇలా చూస్తుంది: + +- Queens వాలుగా (diagonal), నిలువుగా, లేదా అడ్డంగా attack చేయగలవు. కాబట్టి, ప్రతి row లో ఒకే queen, +ప్రతి column లో ఒకే queen, ఇంకా ప్రతి diagonal మీద మహా అయితే ఒక queen ఉండొచ్చు. +- ఒక row లో ఒకే queen ఉండగలదు అని తెలుసు కాబట్టి, మొదటి row నుంచి మొదలుపెట్టి, ఒక queen పెట్టి, +తర్వాత రెండో row కి వెళ్ళి, రెండో queen పెట్టి, అలా కంటిన్యూ చేస్తాం — a) valid solution వచ్చేదాకా గానీ, +b) దారి మూసుకుపోయేదాకా గానీ (అంటే వేరే queens నుంచి "safe" గా ఉండేలా queen పెట్టలేనప్పుడు). +- ఒక row లో ఒకే queen పెడుతున్నాం కాబట్టి, అడ్డం attacks గురించి ఆందోళన అక్కర్లేదు — ఎందుకంటే ఏ +queen కూడా ఇంకో queen ఉన్న row లో ఉండదు. +- అంటే ఒక square మీద queen పెట్టే ముందు మూడు విషయాలు మాత్రమే చెక్ చేయాలి: 1) ఆ square column లో +వేరే queens లేవు, 2) ఆ square ఎడమ diagonal మీద వేరే queens లేవు, 3) ఆ square కుడి diagonal మీద +వేరే queens లేవు. +- Queen ని safe గా పెట్టడానికి ఎక్కడా చోటు లేని point కి వస్తే, ఇప్పటి ప్రయత్నం వదిలేసి వెంటనే next +possibility test చేయొచ్చు. + +ముందు recursive function గురించి మాట్లాడుకుందాం. ఇది 3 parameters తీసుకుంటుంది అని గమనిస్తారు: +`leftDiagonal`, `column`, `rightDiagonal`. ఇవన్నీ technical గా integers, కానీ ఒక integer ని bits వరుసగా +చూపిస్తారు అనే విషయాన్ని algorithm వాడుకుంటుంది. కాబట్టి, ఈ parameters ఒక్కోటి `N` bits వరుస అని +అనుకోండి. + +ప్రతి parameter లో ప్రతి bit అంటే, ఇప్పటి row లో దానికి సంబంధించిన location "ఖాళీగా" ఉందా అని. + +ఉదాహరణకి: +- `N=4` కి, column value `0010` అయితే 3rd column లో ఇప్పటికే ఒక queen ఉంది అని అర్థం. +- `N=8` కి, row 5 దగ్గర ld value `00011000` అయితే, ఆ row లో columns 4, 5 గుండా వెళ్ళే పై-ఎడమ నుంచి +కింద-కుడి diagonals లో ఇప్పటికే queens ఉన్నాయి అని అర్థం. + +`leftDiagonal`, `column`, `rightDiagonal` ని అర్థం చేసుకోడానికి కింద ఒక బొమ్మ ఉంది. + +![](http://gregtrowbridge.com/content/images/2014/Jul/Screenshot-from-2014-06-17-19-46-20.png) + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Eight_queens_puzzle) +- [GeeksForGeeks](https://www.geeksforgeeks.org/backtracking-set-3-n-queen-problem/) +- [YouTube లో Abdul Bari](https://www.youtube.com/watch?v=xFv_Hl4B83A&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) +- [YouTube లో Tushar Roy](https://www.youtube.com/watch?v=xouin83ebxE&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) +- Bitwise Solution + - [Wikipedia](https://en.wikipedia.org/wiki/Eight_queens_puzzle) + - [Greg Trowbridge solution](http://gregtrowbridge.com/a-bitwise-solution-to-the-n-queens-problem-in-javascript/) diff --git a/src/algorithms/uncategorized/rain-terraces/README.md b/src/algorithms/uncategorized/rain-terraces/README.md index cb59346b30..a302fd4f0f 100644 --- a/src/algorithms/uncategorized/rain-terraces/README.md +++ b/src/algorithms/uncategorized/rain-terraces/README.md @@ -1,5 +1,8 @@ # Rain Terraces (Trapping Rain Water) Problem +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + Given an array of non-negative integers representing terraces in an elevation map where the width of each bar is `1`, compute how much water it is able to trap after raining. diff --git a/src/algorithms/uncategorized/rain-terraces/README.tel-IN.md b/src/algorithms/uncategorized/rain-terraces/README.tel-IN.md new file mode 100644 index 0000000000..22a1d59125 --- /dev/null +++ b/src/algorithms/uncategorized/rain-terraces/README.tel-IN.md @@ -0,0 +1,125 @@ +# Rain Terraces (Trapping Rain Water) Problem + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +ఒక elevation map (ఎత్తుల పటం) లో terraces ని సూచించే negative కాని integers ఉన్న array ఇస్తారు — +ప్రతి bar వెడల్పు `1`. వర్షం పడ్డాక ఎంత నీళ్ళు నిలుస్తాయో లెక్కపెట్టండి. + +![Rain Terraces](https://www.geeksforgeeks.org/wp-content/uploads/watertrap.png) + +## Examples + +**Example #1** + +``` +Input: arr[] = [2, 0, 2] +Output: 2 +Structure is like below: + +| | +|_| + +We can trap 2 units of water in the middle gap. +``` + +(మధ్యలో ఉన్న ఖాళీలో 2 units నీళ్ళు నిలుస్తాయి.) + +**Example #2** + +``` +Input: arr[] = [3, 0, 0, 2, 0, 4] +Output: 10 +Structure is like below: + + | +| | +| | | +|__|_| + +We can trap "3*2 units" of water between 3 an 2, +"1 unit" on top of bar 2 and "3 units" between 2 +and 4. See below diagram also. +``` + +(3, 2 మధ్య "3*2 units", bar 2 పైన "1 unit", 2, 4 మధ్య "3 units" నీళ్ళు నిలుస్తాయి.) + +**Example #3** + +``` +Input: arr[] = [0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1] +Output: 6 +Structure is like below: + + | + | || | +_|_||_|||||| + +Trap "1 unit" between first 1 and 2, "4 units" between +first 2 and 3 and "1 unit" between second last 1 and last 2. +``` + +(మొదటి 1, 2 మధ్య "1 unit", మొదటి 2, 3 మధ్య "4 units", చివరి నుంచి రెండో 1, చివరి 2 మధ్య "1 unit" నీళ్ళు నిలుస్తాయి.) + +## Algorithm + +ఒక array element కి ఎడమ, కుడి వైపు ఇంకా ఎత్తైన bars ఉంటేనే అది నీళ్ళు నిలుపుకోగలదు. ఎడమ, కుడి వైపు +bars ఎత్తులు కనుక్కుంటే, ప్రతి element లో ఎంత నీళ్ళు నిలుస్తాయో కనుక్కోవచ్చు. ఐడియా ఏంటంటే — array లో +ప్రతి element లో ఎంత నీళ్ళు నిలుస్తాయో లెక్కపెట్టడం. ఉదాహరణకి, `[3, 0, 0, 2, 0, 4]` array తీసుకుంటే, +3, 2 మధ్య "3*2 units", bar 2 పైన "1 unit", 2, 4 మధ్య "3 units" నీళ్ళు నిలుస్తాయి. పైన diagram కూడా చూడండి. + +### Approach 1: Brute force + +**ఐడియా** + +Array లో ప్రతి element కి, వర్షం తర్వాత అది నిలుపుకోగలిగే maximum నీటి level కనుక్కుంటాం — అది +రెండు వైపులా ఉన్న bars maximum ఎత్తుల్లో తక్కువది, దాని నుంచి దాని సొంత ఎత్తు తీసేస్తే వచ్చేది. + +**Steps** + +- `answer = 0` తో initialize చేయండి +- Array ని ఎడమ నుంచి కుడికి iterate చేయండి: + - `max_left = 0`, `max_right = 0` తో initialize చేయండి + - ఇప్పటి element నుంచి array మొదలు వరకు iterate చేస్తూ update చేయండి: `max_left = max(max_left, height[j])` + - ఇప్పటి element నుంచి array చివరి వరకు iterate చేస్తూ update చేయండి: `max_right = max(max_right, height[j])` + - `min(max_left, max_right) − height[i]` ని `answer` కి కలపండి + +**Complexity Analysis** + +Time complexity: `O(n^2)`. Array లో ప్రతి element కి, ఎడమ, కుడి భాగాలని iterate చేస్తాం. + +Auxiliary space complexity: `O(1)` అదనపు space. + +### Approach 2: Dynamic Programming + +**ఐడియా** + +Brute force లో, ఆ index వరకు అతి ఎత్తైన bar సైజ్ కనుక్కోవడానికే ఎడమ, కుడి భాగాలని మళ్ళీ మళ్ళీ +iterate చేస్తాం. కానీ దీన్ని store చేసుకోవచ్చు. అదిగో, అదే dynamic programming. + +కాబట్టి ప్రతి bar కి ఎడమ, కుడి వైపు అతి ఎత్తైన bar ని ముందే `O(n)` టైమ్ లో లెక్కపెట్టుకోవచ్చు. తర్వాత +ఈ ముందే లెక్కపెట్టిన values వాడి ప్రతి array element లో ఎంత నీళ్ళు ఉన్నాయో కనుక్కోవచ్చు. + +ఈ concept ని ఇలా చూపించారు: + +![DP Trapping Rain Water](https://leetcode.com/problems/trapping-rain-water/Figures/42/trapping_rain_water.png) + +**Steps** + +- ఎడమ చివర నుంచి index `i` వరకు bar maximum ఎత్తు కనుక్కుని `left_max` array లో పెట్టండి. +- కుడి చివర నుంచి index `i` వరకు bar maximum ఎత్తు కనుక్కుని `right_max` array లో పెట్టండి. +- `height` array మీద iterate చేస్తూ `answer` update చేయండి: + - `min(max_left[i], max_right[i]) − height[i]` ని `answer` కి కలపండి. + +**Complexity Analysis** + +Time complexity: `O(n)`. ఒక point వరకు maximum ఎత్తులని ఒక్కోటి `O(n)` ఉండే 2 iterations తో store +చేస్తాం. చివరగా store చేసిన values వాడి `answer` ని `O(n)` లో update చేస్తాం. + +Auxiliary space complexity: `O(n)` అదనపు space. Approach 1 కంటే `left_max`, `right_max` arrays కోసం +అదనపు space కావాలి. + +## References + +- [GeeksForGeeks](https://www.geeksforgeeks.org/trapping-rain-water/) +- [LeetCode](https://leetcode.com/problems/trapping-rain-water/solution/) diff --git a/src/algorithms/uncategorized/recursive-staircase/README.md b/src/algorithms/uncategorized/recursive-staircase/README.md index d7e6f81464..fc632595b4 100644 --- a/src/algorithms/uncategorized/recursive-staircase/README.md +++ b/src/algorithms/uncategorized/recursive-staircase/README.md @@ -1,5 +1,8 @@ # Recursive Staircase Problem +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + ## The Problem There are `n` stairs, a person standing at the bottom wants to reach the top. The person can climb either `1` or `2` stairs at a time. _Count the number of ways, the person can reach the top._ diff --git a/src/algorithms/uncategorized/recursive-staircase/README.tel-IN.md b/src/algorithms/uncategorized/recursive-staircase/README.tel-IN.md new file mode 100644 index 0000000000..b52bc33d8b --- /dev/null +++ b/src/algorithms/uncategorized/recursive-staircase/README.tel-IN.md @@ -0,0 +1,24 @@ +# Recursive Staircase Problem + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +## Problem + +`n` మెట్లు ఉన్నాయి, కింద నిలబడి ఉన్న ఒక వ్యక్తి పైకి చేరాలి. ఆ వ్యక్తి ఒకసారి `1` గానీ `2` గానీ మెట్లు ఎక్కొచ్చు. _ఆ వ్యక్తి పైకి ఎన్ని రకాలుగా చేరొచ్చో లెక్కపెట్టండి._ + +![](https://cdncontribute.geeksforgeeks.org/wp-content/uploads/nth-stair.png) + +## Solution + +ఇది interesting problem — ఎందుకంటే దీన్ని solve చేయడానికి చాలా పద్ధతులు ఉన్నాయి, అవి వేరువేరు programming paradigms ని చూపిస్తాయి. + +- [Brute Force Recursive Solution](./recursiveStaircaseBF.js) - Time: `O(2^n)`; Space: `O(1)` +- [Memoization తో Recursive Solution](./recursiveStaircaseMEM.js) - Time: `O(n)`; Space: `O(n)` +- [Dynamic Programming Solution](./recursiveStaircaseDP.js) - Time: `O(n)`; Space: `O(n)` +- [Iterative Solution](./recursiveStaircaseIT.js) - Time: `O(n)`; Space: `O(1)` + +## References + +- [YouTube లో Gayle Laakmann McDowell](https://www.youtube.com/watch?v=eREiwuvzaUM&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&index=81&t=0s) +- [GeeksForGeeks](https://www.geeksforgeeks.org/count-ways-reach-nth-stair/) diff --git a/src/algorithms/uncategorized/square-matrix-rotation/README.md b/src/algorithms/uncategorized/square-matrix-rotation/README.md index 34ef47f15d..5adfa2b0ac 100644 --- a/src/algorithms/uncategorized/square-matrix-rotation/README.md +++ b/src/algorithms/uncategorized/square-matrix-rotation/README.md @@ -1,5 +1,8 @@ # Square Matrix In-Place Rotation +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + ## The Problem You are given an `n x n` 2D matrix (representing an image). diff --git a/src/algorithms/uncategorized/square-matrix-rotation/README.tel-IN.md b/src/algorithms/uncategorized/square-matrix-rotation/README.tel-IN.md new file mode 100644 index 0000000000..b12c95c763 --- /dev/null +++ b/src/algorithms/uncategorized/square-matrix-rotation/README.tel-IN.md @@ -0,0 +1,110 @@ +# Square Matrix In-Place Rotation + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +## Problem + +మీకు ఒక `n x n` 2D matrix (ఒక image ని సూచించేది) ఇస్తారు. ఆ matrix ని `90` degrees (clockwise — +గడియారం ముల్లు తిరిగే వైపు) తిప్పాలి. + +**Note** + +Image ని **in-place** గా తిప్పాలి — అంటే input 2D matrix నే డైరెక్ట్ గా మార్చాలి. ఇంకో 2D matrix +తీసుకుని rotation చేయడం **చేయకూడదు**. + +## Examples + +**Example #1** + +ఇచ్చిన input matrix: + +``` +[ + [1, 2, 3], + [4, 5, 6], + [7, 8, 9], +] +``` + +Input matrix ని in-place గా తిప్పితే ఇలా అవ్వాలి: + +``` +[ + [7, 4, 1], + [8, 5, 2], + [9, 6, 3], +] +``` + +**Example #2** + +ఇచ్చిన input matrix: + +``` +[ + [5, 1, 9, 11], + [2, 4, 8, 10], + [13, 3, 6, 7], + [15, 14, 12, 16], +] +``` + +Input matrix ని in-place గా తిప్పితే ఇలా అవ్వాలి: + +``` +[ + [15, 13, 2, 5], + [14, 3, 4, 1], + [12, 6, 8, 9], + [16, 7, 10, 11], +] +``` + +## Algorithm + +Matrix ని రెండుసార్లు reflect (అద్దంలో చూసినట్టు తిప్పడం) చేయాలి: + +- నిలువుగా reflect చేయండి +- కింద-ఎడమ నుంచి పై-కుడి వరకు diagonal గా reflect చేయండి + +లేదా పై-ఎడమ/కింద-కుడి diagonal గా reflect చేసి, తర్వాత అడ్డంగా reflect చేయొచ్చు. + +ఎక్కువమంది అడిగే ప్రశ్న — అసలు ఏ రకం reflections చేయాలో ఎలా కనుక్కోవాలి? సింపుల్ — ఒక square +పేపర్ ముక్క చింపి, దాని మీద ఏదో ఒక word రాయండి, దాంతో అది ఎటు తిరిగిందో తెలుస్తుంది. తర్వాత solution +ఎలా వస్తుందో అర్థమయ్యేదాకా ఆ పేపర్ ని అటూ ఇటూ తిప్పి చూడండి. + +పై-కుడి/కింద-ఎడమ diagonal rotation, అడ్డం rotation వాడి మొదటి line ని ఎలా తిప్పొచ్చో example ఇది. + +``` +Let's say we have a string at the top of the matrix: + +A B C +• • • +• • • + +Let's do top-right/bottom-left diagonal reflection: + +A B C +/ / • +/ • • + +And now let's do horizontal reflection: + +A → → +B → → +C → → + +The string has been rotated to 90 degree: + +• • A +• • B +• • C +``` + +(పైన: matrix పైన ఒక string ఉంది అనుకుందాం. ముందు పై-కుడి/కింద-ఎడమ diagonal reflection చేస్తాం, తర్వాత +అడ్డం reflection చేస్తాం. దాంతో string 90 degrees తిరుగుతుంది.) + +## References + +- [LeetCode](https://leetcode.com/problems/rotate-image/description/) diff --git a/src/algorithms/uncategorized/unique-paths/README.md b/src/algorithms/uncategorized/unique-paths/README.md index 924c97ba1f..310a84be47 100644 --- a/src/algorithms/uncategorized/unique-paths/README.md +++ b/src/algorithms/uncategorized/unique-paths/README.md @@ -1,5 +1,8 @@ # Unique Paths Problem +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + A robot is located at the top-left corner of a `m x n` grid (marked 'Start' in the diagram below). diff --git a/src/algorithms/uncategorized/unique-paths/README.tel-IN.md b/src/algorithms/uncategorized/unique-paths/README.tel-IN.md new file mode 100644 index 0000000000..1595398051 --- /dev/null +++ b/src/algorithms/uncategorized/unique-paths/README.tel-IN.md @@ -0,0 +1,105 @@ +# Unique Paths Problem + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +ఒక robot `m x n` grid లో పై-ఎడమ మూలలో ఉంది (కింద diagram లో 'Start' అని mark చేసింది). + +Robot ఏ టైమ్ లో అయినా కిందకి గానీ కుడికి గానీ మాత్రమే కదలగలదు. Robot grid లో కింద-కుడి మూలకి +(కింద diagram లో 'Finish' అని mark చేసింది) చేరడానికి ట్రై చేస్తోంది. + +మొత్తం ఎన్ని unique paths (వేరువేరు దారులు) ఉన్నాయి? + +![Unique Paths](https://leetcode.com/static/images/problemset/robot_maze.png) + +## Examples + +**Example #1** + +``` +Input: m = 3, n = 2 +Output: 3 +Explanation: +From the top-left corner, there are a total of 3 ways to reach the bottom-right corner: +1. Right -> Right -> Down +2. Right -> Down -> Right +3. Down -> Right -> Right +``` + +(పై-ఎడమ మూల నుంచి కింద-కుడి మూలకి చేరడానికి మొత్తం 3 దారులు ఉన్నాయి.) + +**Example #2** + +``` +Input: m = 7, n = 3 +Output: 28 +``` + +## Algorithms + +### Backtracking + +మొదట మనసులోకి వచ్చే ఆలోచన ఏంటంటే — ఒక decision tree కట్టాలి, అందులో `D` అంటే కిందకి కదలడం, `R` +అంటే కుడికి కదలడం. ఉదాహరణకి `width = 3`, `height = 2` ఉన్న board కి ఈ decision tree వస్తుంది: + +``` + START + / \ + D R + / / \ + R D R + / / \ + R R D + + END END END +``` + +ఇక్కడ మూడు unique branches కనిపిస్తున్నాయి — అదే మన problem కి answer. + +**Time Complexity**: `O(2 ^ n)` - `n` సైజ్ ఉన్న square board కి worst case లో దాదాపుగా. + +**Auxiliary Space Complexity**: `O(m + n)` - ఎందుకంటే ఇప్పటి path ని positions తో store చేయాలి. + +### Dynamic Programming + +`BOARD[i][j]` ని మన sub-problem గా చూద్దాం. + +కుడికి, కిందకి మాత్రమే కదలాలి అనే condition ఉంది కాబట్టి — ఇప్పటి cell కి unique paths సంఖ్య అంటే, +దాని పైన ఉన్న cell కి unique paths సంఖ్య, దాని ఎడమ వైపు ఉన్న cell కి unique paths సంఖ్య — ఈ రెండూ +కలిపితే వచ్చేది అని చెప్పొచ్చు. + +``` +BOARD[i][j] = BOARD[i - 1][j] + BOARD[i][j - 1]; // since we can only move down or right. +``` + +Base cases ఇవి: + +``` +BOARD[0][any] = 1; // only one way to reach any top slot. +BOARD[any][0] = 1; // only one way to reach any slot in the leftmost column. +``` + +(పైన ఏ slot కైనా చేరడానికి ఒకే దారి; ఎడమ column లో ఏ slot కైనా చేరడానికి ఒకే దారి.) + +`3 x 2` board కి మన dynamic programming matrix ఇలా ఉంటుంది: + +| | 0 | 1 | 1 | +|:---:|:---:|:---:|:---:| +|**0**| 0 | 1 | 1 | +|**1**| 1 | 2 | 3 | + +ప్రతి cell లో దానికి ఉన్న unique paths సంఖ్య ఉంటుంది. మనకి కావాల్సింది నంబర్ `3` ఉన్న కింద-కుడి cell. + +**Time Complexity**: `O(m * n)` - ఎందుకంటే DP matrix లో ప్రతి cell గుండా వెళ్తాం. + +**Auxiliary Space Complexity**: `O(m * n)` - ఎందుకంటే DP matrix కావాలి. + +### Pascal's Triangle మీద బేస్ అయినది + +ఈ ప్రశ్న నిజానికి Pascal Triangle కి ఇంకో రూపం. + +ఈ rectangle మూల, Pascal's Triangle లో `m + n - 2` line లో, `min(m, n) - 1` position లో ఉంటుంది. + +## References + +- [LeetCode](https://leetcode.com/problems/unique-paths/description/) diff --git a/src/data-structures/bloom-filter/README.md b/src/data-structures/bloom-filter/README.md index 7880a7f7be..be62f1b4a6 100644 --- a/src/data-structures/bloom-filter/README.md +++ b/src/data-structures/bloom-filter/README.md @@ -3,7 +3,8 @@ _Read this in other languages:_ [_Русский_](README.ru-RU.md), [_Português_](README.pt-BR.md), -[_Українська_](README.uk-UA.md) +[_Українська_](README.uk-UA.md), +[_తెలుగు_](README.tel-IN.md) A **bloom filter** is a space-efficient probabilistic data structure designed to test whether an element diff --git a/src/data-structures/bloom-filter/README.tel-IN.md b/src/data-structures/bloom-filter/README.tel-IN.md new file mode 100644 index 0000000000..086fdbb6ea --- /dev/null +++ b/src/data-structures/bloom-filter/README.tel-IN.md @@ -0,0 +1,99 @@ +# Bloom Filter + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Русский_](README.ru-RU.md), +[_Português_](README.pt-BR.md), +[_Українська_](README.uk-UA.md) + +**Bloom filter** అనేది ఒక element ఒక set లో ఉందో లేదో test చేయడానికి డిజైన్ చేసిన, తక్కువ space వాడే +probabilistic data structure. ఇది చాలా చాలా ఫాస్ట్ గా ఉండేలా, అతి తక్కువ memory వాడేలా డిజైన్ చేశారు — +దానికి బదులుగా false positives రావొచ్చు. False positive matches రావొచ్చు, కానీ false negatives రావు — +ఇంకోలా చెప్పాలంటే, query కి "బహుశా set లో ఉంది" లేదా "ఖచ్చితంగా set లో లేదు" అనే answer వస్తుంది. + +"మామూలు" error లేని hashing techniques వాడితే, source data మరీ ఎక్కువ కాబట్టి memory చాలా చాలా ఎక్కువ +కావాల్సి వచ్చే applications కోసం Bloom ఈ technique ప్రతిపాదించాడు. + +## Algorithm description + +ఖాళీ Bloom filter అంటే `m` bits ఉన్న bit array, అన్నీ `0` గా set అయి ఉంటాయి. ఇంకా `k` వేరువేరు hash +functions define చేసి ఉండాలి — ఒక్కోటి ఒక set element ని `m` array positions లో ఒకదానికి map (hash) +చేస్తుంది, uniform random distribution వచ్చేలా. మామూలుగా `k` ఒక constant, `m` కంటే చాలా చిన్నది — `m` +అనేది కలపబోయే elements సంఖ్యకి proportional. `k` ని ఎంత పెట్టాలి, `m` proportionality constant ఎంత +అనేది filter కి ఎంత false positive rate కావాలో దాన్ని బట్టి నిర్ణయిస్తారు. + +`{x, y, z}` set ని సూచించే Bloom filter example ఇది. రంగు arrows ప్రతి set element bit array లో ఏ +positions కి map అయిందో చూపిస్తాయి. Element `w`, `{x, y, z}` set లో లేదు — ఎందుకంటే అది `0` ఉన్న ఒక +bit-array position కి hash అవుతుంది. ఈ బొమ్మలో `m = 18`, `k = 3`. + +![Bloom Filter](https://upload.wikimedia.org/wikipedia/commons/a/ac/Bloom_filter.svg) + +## Operations + +Bloom filter చేయగలిగే రెండు ముఖ్యమైన operations: _insertion_, _search_. Search లో false positives రావొచ్చు. +Deletion కుదరదు. + +ఇంకోలా చెప్పాలంటే, filter లో items వేయొచ్చు. ఒక item ఇంతకుముందు వేశామా అని చెక్ చేస్తే, అది "లేదు" అని +గానీ "బహుశా" అని గానీ చెప్తుంది. + +Insertion, search రెండూ `O(1)` operations. + +## Filter తయారుచేయడం + +ఒక fixed సైజ్ ఇచ్చి bloom filter తయారుచేస్తారు. మన example లో default length `100`. అన్ని locations +`false` తో initialize అవుతాయి. + +### Insertion + +Insertion సమయంలో, input కి hashes తయారుచేయడానికి కొన్ని hash functions (మన case లో `3` hash functions) +వాడతారు. ఈ hash functions indexes ఇస్తాయి. వచ్చిన ప్రతి index దగ్గర, bloom filter లో value ని `true` గా +మారుస్తాం అంతే. + +### Search + +Search సమయంలో, అవే hash functions ని call చేసి input ని hash చేస్తారు. తర్వాత వచ్చిన indexes _అన్నిటికీ_ +bloom filter లో `true` value ఉందా అని చెక్ చేస్తాం. _అన్నిటికీ_ `true` ఉంటే, ఆ value ఇంతకుముందు bloom +filter లో వేసి ఉండొచ్చు అని తెలుస్తుంది. + +కానీ, అది ఖచ్చితం కాదు — ఎందుకంటే ఇంతకుముందు వేసిన వేరే values ఆ positions ని `true` గా మార్చి ఉండొచ్చు. +ఇప్పుడు వెతుకుతున్న item వల్లే values `true` అయ్యాయి అని చెప్పలేం. ఇంతకుముందు ఒకే ఒక్క item వేస్తే తప్ప, +100% ఖచ్చితంగా చెప్పడం కుదరదు. + +Hash functions ఇచ్చిన indexes కోసం bloom filter చెక్ చేసేటప్పుడు, వాటిలో ఒక్కదానికి `false` value ఉన్నా, +ఆ item ఇంతకుముందు వేయలేదు అని ఖచ్చితంగా తెలుస్తుంది. + +## False Positives + +False positives వచ్చే probability మూడు విషయాల మీద ఆధారపడి ఉంటుంది: bloom filter సైజ్, మనం వాడే hash +functions సంఖ్య, filter లో వేసిన items సంఖ్య. + +False positive probability లెక్కపెట్టే formula: + +( 1 - e -kn/m ) k + +`k` = hash functions సంఖ్య + +`m` = filter సైజ్ + +`n` = వేసిన items సంఖ్య + +False positives ఎంత వరకు ఓకే అనేదాన్ని బట్టి `k`, `m`, `n` variables ఎంచుకోవాలి. Values ఎంచుకున్నాక +వచ్చే probability మరీ ఎక్కువగా ఉంటే, values మార్చి probability మళ్ళీ లెక్కపెట్టాలి. + +## ఎక్కడ వాడతారు + +Bloom filter ని ఒక blogging website లో వాడొచ్చు. Readers కి వాళ్ళు ఇంతకుముందు ఎప్పుడూ చూడని articles +మాత్రమే చూపించాలంటే, bloom filter perfect. Articles మీద బేస్ అయిన hashed values ని ఇది store చేయొచ్చు. +User కొన్ని articles చదివాక, వాటిని filter లో వేయొచ్చు. తర్వాత user site కి వచ్చినప్పుడు, ఆ articles ని +results నుంచి తీసేయొచ్చు. + +కొన్ని articles పొరపాటున filter అయిపోవడం తప్పదు, కానీ ఆ నష్టం ఓకే. User site కి వచ్చిన ప్రతిసారి చూడటానికి +వేరే కొత్త articles ఉన్నంత వరకు, కొన్ని articles ఎప్పుడూ చూడకపోయినా పర్లేదు. + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Bloom_filter) +- [Examples తో Bloom Filters](http://llimllib.github.io/bloomfilter-tutorial/) +- [False Positive Probability లెక్కపెట్టడం](https://hur.st/bloomfilter/?n=4&p=&m=18&k=3) +- [Medium లో Bloom Filters](https://blog.medium.com/what-are-bloom-filters-1ec2a50c68ff) +- [YouTube లో Bloom Filters](https://www.youtube.com/watch?v=bEmBh1HtYrw) diff --git a/src/data-structures/deque/README.md b/src/data-structures/deque/README.md index 622e54b282..0ba4b8262f 100644 --- a/src/data-structures/deque/README.md +++ b/src/data-structures/deque/README.md @@ -1,5 +1,8 @@ # Deque (Double-Ended Queue) +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + A **deque** (pronounced "deck", short for **double-ended queue**) is a linear data structure that generalizes both a stack and a queue. Elements can be added or removed from **either end** — the front (head) or the back (tail) — in **O(1)** time. diff --git a/src/data-structures/deque/README.tel-IN.md b/src/data-structures/deque/README.tel-IN.md new file mode 100644 index 0000000000..928c740470 --- /dev/null +++ b/src/data-structures/deque/README.tel-IN.md @@ -0,0 +1,75 @@ +# Deque (Double-Ended Queue) + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +**Deque** ("deck" అని పలుకుతారు, **double-ended queue** కి షార్ట్ ఫామ్) అనేది stack, queue రెండిటినీ +కలిపిన ఒక జనరల్ linear data structure. Elements ని **ఏ చివర నుంచైనా** — ముందు (head) నుంచి గానీ వెనక +(tail) నుంచి గానీ — **O(1)** టైమ్ లో కలపొచ్చు, తీసేయొచ్చు. + +``` + addFront(3) addBack(4) + ↓ ↓ + ┌───────┬───────┬───────┬───────┐ + │ 3 │ 1 │ 2 │ 4 │ ← internal doubly linked list + └───────┴───────┴───────┴───────┘ + ↑ ↑ + removeFront() removeBack() +``` + +## Operations + +| Method | ఏం చేస్తుంది | Time | +| --------------- | -------------------------------------------- | ---- | +| `addFront(v)` | Element `v` ని ముందు కలుపుతుంది | O(1) | +| `addBack(v)` | Element `v` ని వెనక కలుపుతుంది | O(1) | +| `removeFront()` | ముందు ఉన్న element ని తీసేసి return చేస్తుంది | O(1) | +| `removeBack()` | వెనక ఉన్న element ని తీసేసి return చేస్తుంది | O(1) | +| `peekFront()` | ముందు ఉన్న element ని తీసేయకుండా return చేస్తుంది | O(1) | +| `peekBack()` | వెనక ఉన్న element ని తీసేయకుండా return చేస్తుంది | O(1) | +| `isEmpty()` | Deque లో elements లేకపోతే `true` return చేస్తుంది | O(1) | +| `size` | Elements సంఖ్య return చేస్తుంది | O(1) | + +> **Note:** `size` O(1) — ఎందుకంటే deque ప్రతి add, remove operation లో update అయ్యే ఒక element +> లెక్కని ఉంచుకుంటుంది. + +## Complexity + +| Operation | Time | +| ---------------------------- | ---- | +| `addFront` / `addBack` | O(1) | +| `removeFront` / `removeBack` | O(1) | +| `peekFront` / `peekBack` | O(1) | +| `isEmpty` / `size` | O(1) | +| Space | O(n) | + +## ఎక్కడ వాడతారు + +**రెండు చివర్లలోనూ O(1) access** కావాల్సినప్పుడు deque కరెక్ట్ tool: + +- **Sliding window maximum/minimum** — candidates ని ఒక monotonic deque లో ఉంచితే ప్రతి element మహా అయితే + ఒకసారి push, ఒకసారి pop అవుతుంది (మొత్తం O(n)). +- **Browser history** — pages మధ్య వెనక్కి (`removeFront`), ముందుకి (`removeBack`) వెళ్ళడం. +- **Undo / redo stacks** — actions ని వెనక push చేయడం, వెనక నుంచి undo చేయడం, ముందు నుంచి redo చేయడం. +- **Palindrome checking** — రెండు చివర్ల నుంచి ఒకేసారి characters compare చేయడం. +- **Work-stealing schedulers** (ఉదాహరణకి Java `ForkJoinPool`) — threads తమ సొంత వెనక చివర నుంచి push/pop + చేస్తాయి, ఖాళీగా ఉన్న threads ఇంకో thread ముందు చివర నుంచి పని తీసుకుంటాయి. + +## Implementation Note + +ఈ implementation, project లో ఇప్పటికే ఉన్న [`DoublyLinkedList`](../doubly-linked-list) మీద బేస్ అయింది. +ప్రతి node తన ముందు, తర్వాత neighbours రెండిటికీ reference ఉంచుకుంటుంది కాబట్టి — O(1) `prepend` +(`addFront` కోసం), O(1) `deleteHead` (`removeFront` కోసం), O(1) `append` / `deleteTail` (`addBack` / +`removeBack` కోసం) వస్తాయి, array elements ని జరపాల్సిన అవసరం ఉండదు. Elements సంఖ్యని ఒక counter లో +ట్రాక్ చేస్తారు, కాబట్టి `size` కూడా O(1). + +Circular buffer (fixed-size array) వాడే ఇంకో implementation కి cache locality బెటర్ గా ఉంటుంది, కానీ +resize చేసే logic కావాలి. ఈ project లో మిగతా data structures తో consistent గా ఉండటానికి ఇక్కడ linked-list +పద్ధతి ఎంచుకున్నారు. + +## References + +- [Deque — Wikipedia](https://en.wikipedia.org/wiki/Double-ended_queue) +- [Deque Data Structure — GeeksForGeeks](https://www.geeksforgeeks.org/deque-set-1-introduction-applications/) +- [▶ Deque (Double-Ended Queue) — YouTube](https://www.youtube.com/watch?v=pqg0SOPRlJ4) +- [▶ Deque వాడి Sliding Window Maximum — YouTube](https://www.youtube.com/watch?v=2SXqBsTR6a8) diff --git a/src/data-structures/disjoint-set/README.md b/src/data-structures/disjoint-set/README.md index 772f68191b..316f47f43d 100644 --- a/src/data-structures/disjoint-set/README.md +++ b/src/data-structures/disjoint-set/README.md @@ -3,7 +3,8 @@ _Read this in other languages:_ [_Русский_](README.ru-RU.md), [_Português_](README.pt-BR.md), -[_Українська_](README.uk-UA.md) +[_Українська_](README.uk-UA.md), +[_తెలుగు_](README.tel-IN.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. diff --git a/src/data-structures/disjoint-set/README.tel-IN.md b/src/data-structures/disjoint-set/README.tel-IN.md new file mode 100644 index 0000000000..c8c95cf294 --- /dev/null +++ b/src/data-structures/disjoint-set/README.tel-IN.md @@ -0,0 +1,32 @@ +# Disjoint Set + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Русский_](README.ru-RU.md), +[_Português_](README.pt-BR.md), +[_Українська_](README.uk-UA.md) + +**Disjoint-set** data structure (దీన్నే union–find data structure లేదా merge–find set అని కూడా అంటారు) +అనేది కొన్ని elements set ని ఒకదానితో ఒకటి కలవని (non-overlapping) subsets గా విడగొట్టి ట్రాక్ చేసే data +structure. _కొత్త sets కలపడానికి_, _ఉన్న sets ని merge చేయడానికి_, ఇంకా _elements ఒకే set లో ఉన్నాయా +అని తేల్చడానికి_ దాదాపు constant-time operations ఇస్తుంది (inverse Ackermann function తో bound అయి ఉంటుంది). +చాలా ఇతర ఉపయోగాలతో పాటు (Applications section చూడండి), graph కి minimum spanning tree కనుక్కునే Kruskal's +algorithm లో disjoint-sets కీలక పాత్ర పోషిస్తాయి. + +![disjoint set](https://upload.wikimedia.org/wikipedia/commons/6/67/Dsu_disjoint_sets_init.svg) + +_MakeSet_ 8 singletons (ఒక్కో element ఉన్న sets) తయారుచేస్తుంది. + +![disjoint set](https://upload.wikimedia.org/wikipedia/commons/a/ac/Dsu_disjoint_sets_final.svg) + +కొన్ని _Union_ operations తర్వాత, కొన్ని sets కలిసిపోయాయి. + +## Implementation + +- [DisjointSet.js](./DisjointSet.js) +- [DisjointSetAdhoc.js](./DisjointSetAdhoc.js) - DisjointSet (లేదా UnionFind) data structure యొక్క చిన్న (ad hoc) version — దీనికి బయటి dependencies ఏమీ లేవు, coding interview లో interviewer ఒప్పుకుంటే ఈజీగా copy-paste చేసి వాడుకోవచ్చు (ఎందుకంటే JS లో చాలా data structures లేవు). + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Disjoint-set_data_structure) +- [YouTube లో Abdul Bari](https://www.youtube.com/watch?v=wU6udHRIkcc&index=14&t=0s&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/data-structures/doubly-linked-list/README.es-ES.md b/src/data-structures/doubly-linked-list/README.es-ES.md index 490466d74b..c1193fa0ff 100644 --- a/src/data-structures/doubly-linked-list/README.es-ES.md +++ b/src/data-structures/doubly-linked-list/README.es-ES.md @@ -5,7 +5,8 @@ _Lea esto en otros idiomas:_ [_简体中文_](README.zh-CN.md), [_日本語_](README.ja-JP.md), [_Português_](README.pt-BR.md) -[_한국어_](README.ko-KR.md) +[_한국어_](README.ko-KR.md), +[_తెలుగు_](README.tel-IN.md) En informática, una **lista doblemente enlazada** es una estructura de datos relacionados que consta de un conjunto de registros conectados secuencialmente llamados nodos. Cada nodo contiene dos campos, llamados enlaces, que son referencias al nodo anterior y al siguiente en la secuencia de nodos. Los enlaces anterior y siguiente de los nodos inicial y final, apuntan respectivamente a algún tipo de terminador (normalmente un nodo centinela o nulo), facilitando así el recorrido de la lista. Si solo hay un nodo nulo, la lista se enlaza circularmente a través este. Puede conceptualizarse como dos listas enlazadas individualmente formadas a partir de los mismos elementos de datos, pero en órdenes secuenciales opuestos. diff --git a/src/data-structures/doubly-linked-list/README.ko-KR.md b/src/data-structures/doubly-linked-list/README.ko-KR.md index 9f60e54f32..632469ef4a 100644 --- a/src/data-structures/doubly-linked-list/README.ko-KR.md +++ b/src/data-structures/doubly-linked-list/README.ko-KR.md @@ -4,7 +4,8 @@ _Read this in other languages:_ [_Русский_](README.ru-RU.md), [_简体中文_](README.zh-CN.md), [_日本語_](README.ja-JP.md), -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) 컴퓨터공학에서 **이중 연결 리스트**는 순차적으로 링크된 노드라는 레코드 세트로 구성된 링크된 데이터 구조입니다. 각 노드에는 링크라고 하는 두 개의 필드가 있으며, 노드 순서에서 이전 노드와 다음 노드에 대한 참조를 가집니다. diff --git a/src/data-structures/doubly-linked-list/README.md b/src/data-structures/doubly-linked-list/README.md index 1610d1e497..92d03fe6d7 100644 --- a/src/data-structures/doubly-linked-list/README.md +++ b/src/data-structures/doubly-linked-list/README.md @@ -7,7 +7,8 @@ _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) +[_Українська_](README.uk-UA.md), +[_తెలుగు_](README.tel-IN.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 diff --git a/src/data-structures/doubly-linked-list/README.tel-IN.md b/src/data-structures/doubly-linked-list/README.tel-IN.md new file mode 100644 index 0000000000..a3272e3d50 --- /dev/null +++ b/src/data-structures/doubly-linked-list/README.tel-IN.md @@ -0,0 +1,116 @@ +# Doubly Linked List + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Русский_](README.ru-RU.md), +[_简体中文_](README.zh-CN.md), +[_日本語_](README.ja-JP.md), +[_Português_](README.pt-BR.md), +[_한국어_](README.ko-KR.md), +[_Español_](README.es-ES.md), +[_Українська_](README.uk-UA.md) + +Computer science లో **doubly linked list** అనేది ఒక linked data structure — ఇందులో nodes అనే, వరుసగా +link అయిన records set ఉంటుంది. ప్రతి node లో links అనే రెండు fields ఉంటాయి — అవి nodes వరుసలో ముందు +node కి, తర్వాత node కి references. List ని traverse చేయడం ఈజీ అవ్వడానికి, మొదటి node యొక్క previous +link, చివరి node యొక్క next link ఏదో ఒక రకమైన terminator ని point చేస్తాయి — మామూలుగా ఒక sentinel node +గానీ null గానీ. ఒకే ఒక్క sentinel node ఉంటే, ఆ sentinel node ద్వారా list circular గా link అవుతుంది. దీన్ని +అవే data items తో, కానీ ఎదురెదురు వరుసల్లో తయారైన రెండు singly linked lists గా ఊహించుకోవచ్చు. + +![Doubly Linked List](./images/doubly-linked-list.jpeg) + +_[okso.app](https://okso.app) తో తయారుచేశారు_ + +రెండు node links వల్ల list ని ఏ direction లో అయినా traverse చేయొచ్చు. Doubly linked list లో node కలపడానికి +గానీ తీసేయడానికి గానీ, singly linked list తో పోలిస్తే ఎక్కువ links మార్చాలి — కానీ operations ఇంకా సింపుల్ +గా, (మొదటి nodes కాకుండా వేరే nodes కి) ఇంకా ఫాస్ట్ గా ఉండొచ్చు. ఎందుకంటే traverse చేసేటప్పుడు ముందు +node ని ట్రాక్ చేయాల్సిన అవసరం లేదు, లేదా ముందు node link మార్చడానికి దాన్ని వెతుకుతూ list traverse +చేయాల్సిన అవసరం లేదు. + +## Basic Operations కి Pseudocode + +### Insert + +```text +Add(value) + Pre: value is the value to add to the list + Post: value has been placed at the tail of the list + n ← node(value) + if head = ø + head ← n + tail ← n + else + n.previous ← tail + tail.next ← n + tail ← n + end if +end Add +``` + +### Delete + +```text +Remove(head, value) + Pre: head is the head node in the list + value is the value to remove from the list + Post: value is removed from the list, true; otherwise 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 +``` + +### Reverse Traversal + +```text +ReverseTraversal(tail) + Pre: tail is the node of the list to traverse + Post: the list has been traversed in reverse order + n ← tail + while n != ø + yield n.value + n ← n.previous + end while +end Reverse Traversal +``` + +## Complexities + +## Time Complexity + +| Access | Search | Insertion | Deletion | +| :----: | :----: | :-------: | :------: | +| O(n) | O(n) | O(1) | O(n) | + +### Space Complexity + +O(n) + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Doubly_linked_list) +- [YouTube](https://www.youtube.com/watch?v=JdQeNxWCguQ&t=7s&index=72&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/data-structures/graph/README.md b/src/data-structures/graph/README.md index 790602b536..52c17247af 100644 --- a/src/data-structures/graph/README.md +++ b/src/data-structures/graph/README.md @@ -5,7 +5,8 @@ _Read this in other languages:_ [_Русский_](README.ru-RU.md), [_Français_](README.fr-FR.md), [_Português_](README.pt-BR.md), -[_Українська_](README.uk-UA.md) +[_Українська_](README.uk-UA.md), +[_తెలుగు_](README.tel-IN.md) In computer science, a **graph** is an abstract data type diff --git a/src/data-structures/graph/README.tel-IN.md b/src/data-structures/graph/README.tel-IN.md new file mode 100644 index 0000000000..4a4ca143b7 --- /dev/null +++ b/src/data-structures/graph/README.tel-IN.md @@ -0,0 +1,30 @@ +# Graph + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_简体中文_](README.zh-CN.md), +[_Русский_](README.ru-RU.md), +[_Français_](README.fr-FR.md), +[_Português_](README.pt-BR.md), +[_Українська_](README.uk-UA.md) + + +Computer science లో **graph** అనేది ఒక abstract data type — mathematics లో, ముఖ్యంగా graph theory +లో ఉండే undirected graph, directed graph concepts ని implement చేయడానికి ఇది ఉద్దేశించబడింది. + +Graph data structure లో vertices (లేదా nodes లేదా points) ఉన్న ఒక finite (మార్చగలిగే కూడా కావొచ్చు) +set ఉంటుంది. దాంతో పాటు undirected graph అయితే ఈ vertices యొక్క unordered pairs set, directed graph +అయితే ordered pairs set ఉంటుంది. Undirected graph లో ఈ pairs ని edges, arcs, లేదా lines అంటారు; +directed graph లో వాటిని arrows, directed edges, directed arcs, లేదా directed lines అంటారు. Vertices +graph structure లో భాగం కావొచ్చు, లేదా integer indices లేదా references తో సూచించే బయటి entities +కావొచ్చు. + +![Graph](./images/graph.jpeg) + +*[okso.app](https://okso.app) తో తయారుచేశారు* + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Graph_(abstract_data_type)) +- [YouTube లో Graphs పరిచయం](https://www.youtube.com/watch?v=gXgEDyodOJU&index=9&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) +- [YouTube లో Graphs representation](https://www.youtube.com/watch?v=k1wraWzqtvQ&index=10&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/data-structures/hash-table/README.ko-KR.md b/src/data-structures/hash-table/README.ko-KR.md index b3a8c94066..cdd2459372 100644 --- a/src/data-structures/hash-table/README.ko-KR.md +++ b/src/data-structures/hash-table/README.ko-KR.md @@ -5,7 +5,8 @@ _Read this in other languages:_ [_Русский_](README.ru-RU.md), [_日本語_](README.ja-JP.md), [_Français_](README.fr-FR.md), -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) 컴퓨팅에서, **해시 테이블**(해시 맵)은 키를 값에 매핑할 수 있는 구조인 *연관 배열*을 구현하는 자료 구조입니다. 해시 테이블은 *해시 함수*를 사용해 원하는 값을 담을 수 있는 버킷 또는 슬롯 배열의 인덱스를 계산합니다. diff --git a/src/data-structures/hash-table/README.md b/src/data-structures/hash-table/README.md index f0d0c9932d..c387ee7006 100644 --- a/src/data-structures/hash-table/README.md +++ b/src/data-structures/hash-table/README.md @@ -7,7 +7,8 @@ _Read this in other languages:_ [_Français_](README.fr-FR.md), [_Português_](README.pt-BR.md), [_한국어_](README.ko-KR.md), -[_Українська_](README.uk-UA.md) +[_Українська_](README.uk-UA.md), +[_తెలుగు_](README.tel-IN.md) In computing, a **hash table** (hash map) is a data structure which implements an _associative array_ diff --git a/src/data-structures/hash-table/README.tel-IN.md b/src/data-structures/hash-table/README.tel-IN.md new file mode 100644 index 0000000000..9e6e92e2f4 --- /dev/null +++ b/src/data-structures/hash-table/README.tel-IN.md @@ -0,0 +1,33 @@ +# Hash Table + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_简体中文_](README.zh-CN.md), +[_Русский_](README.ru-RU.md), +[_日本語_](README.ja-JP.md), +[_Français_](README.fr-FR.md), +[_Português_](README.pt-BR.md), +[_한국어_](README.ko-KR.md), +[_Українська_](README.uk-UA.md) + +Computing లో **hash table** (hash map) అనేది _associative array_ అనే abstract data type ని implement +చేసే data structure — అంటే _keys ని values కి map చేయగలిగే_ structure. Hash table ఒక _hash function_ +వాడి buckets లేదా slots ఉన్న array లో ఒక index లెక్కపెడుతుంది, ఆ index నుంచి మనకి కావాల్సిన value +దొరుకుతుంది. + +ఆదర్శంగా, hash function ప్రతి key కి ఒక unique bucket ఇవ్వాలి. కానీ చాలా hash table designs +perfect కాని hash function వాడతాయి — దాంతో hash collisions రావొచ్చు, అంటే hash function ఒకటి కంటే +ఎక్కువ keys కి ఒకే index ఇస్తుంది. ఇలాంటి collisions ని ఏదో ఒక రకంగా handle చేయాలి. + +![Hash Table](./images/hash-table.jpeg) + +Separate chaining తో hash collision ని పరిష్కరించడం. + +![Hash Collision](./images/collision-resolution.jpeg) + +_[okso.app](https://okso.app) తో తయారుచేశారు_ + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Hash_table) +- [YouTube](https://www.youtube.com/watch?v=shs0KM3wKv8&index=4&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/data-structures/heap/README.md b/src/data-structures/heap/README.md index 392c5c96bc..a9509145f3 100644 --- a/src/data-structures/heap/README.md +++ b/src/data-structures/heap/README.md @@ -8,7 +8,8 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), [_Türkçe_](README.tr-TR.md), [_한국어_](README.ko-KR.md), -[_Українська_](README.uk-UA.md) +[_Українська_](README.uk-UA.md), +[_తెలుగు_](README.tel-IN.md) In computer science, a **heap** is a specialized tree-based diff --git a/src/data-structures/heap/README.tel-IN.md b/src/data-structures/heap/README.tel-IN.md new file mode 100644 index 0000000000..f4fbff8001 --- /dev/null +++ b/src/data-structures/heap/README.tel-IN.md @@ -0,0 +1,66 @@ +# Heap (data-structure) + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_简体中文_](README.zh-CN.md), +[_Русский_](README.ru-RU.md), +[_日本語_](README.ja-JP.md), +[_Français_](README.fr-FR.md), +[_Português_](README.pt-BR.md), +[_Türkçe_](README.tr-TR.md), +[_한국어_](README.ko-KR.md), +[_Українська_](README.uk-UA.md) + + +Computer science లో **heap** అనేది tree మీద బేస్ అయిన ఒక ప్రత్యేక data structure — ఇది కింద చెప్పిన +heap property ని పాటిస్తుంది. + +*Min heap* లో, `P` అనేది `C` కి parent node అయితే, `P` key (value) ఎప్పుడూ `C` key కంటే తక్కువ లేదా +సమానంగా ఉంటుంది. + +![MinHeap](./images/min-heap.jpeg) + +*[okso.app](https://okso.app) తో తయారుచేశారు* + +*Max heap* లో, `P` key ఎప్పుడూ `C` key కంటే ఎక్కువ లేదా సమానంగా ఉంటుంది + +![MaxHeap](./images/max-heap.jpeg) + +![Array Representation](./images/array-representation.jpeg) + +Heap "పైన" ఉండే, parents లేని node ని root node అంటారు. + +## Time Complexities + +వేరువేరు heap data structures time complexities ఇవి. Function పేర్లు max-heap కోసం అనుకున్నవి. + +| Operation | find-max | delete-max | insert| increase-key| meld | +| --------- | -------- | ---------- | ----- | ----------- | ---- | +| [Binary](https://en.wikipedia.org/wiki/Binary_heap) | `Θ(1)` | `Θ(log n)` | `O(log n)` | `O(log n)` | `Θ(n)` | +| [Leftist](https://en.wikipedia.org/wiki/Leftist_tree) | `Θ(1)` | `Θ(log n)` | `Θ(log n)` | `O(log n)` | `Θ(log n)` | +| [Binomial](https://en.wikipedia.org/wiki/Binomial_heap) | `Θ(1)` | `Θ(log n)` | `Θ(1)` | `O(log n)` | `O(log n)` | +| [Fibonacci](https://en.wikipedia.org/wiki/Fibonacci_heap) | `Θ(1)` | `Θ(log n)` | `Θ(1)` | `Θ(1)` | `Θ(1)` | +| [Pairing](https://en.wikipedia.org/wiki/Pairing_heap) | `Θ(1)` | `Θ(log n)` | `Θ(1)` | `o(log n)` | `Θ(1)` | +| [Brodal](https://en.wikipedia.org/wiki/Brodal_queue) | `Θ(1)` | `Θ(log n)` | `Θ(1)` | `Θ(1)` | `Θ(1)` | +| [Rank-pairing](https://en.wikipedia.org/w/index.php?title=Rank-pairing_heap&action=edit&redlink=1) | `Θ(1)` | `Θ(log n)` | `Θ(1)` | `Θ(1)` | `Θ(1)` | +| [Strict Fibonacci](https://en.wikipedia.org/wiki/Fibonacci_heap) | `Θ(1)` | `Θ(log n)` | `Θ(1)` | `Θ(1)` | `Θ(1)` | +| [2-3 heap](https://en.wikipedia.org/wiki/2%E2%80%933_heap) | `O(log n)` | `O(log n)` | `O(log n)` | `Θ(1)` | `?` | + +ఇక్కడ: +- **find-max (లేదా find-min):** max-heap లో maximum item ని, లేదా min-heap లో minimum item ని కనుక్కోవడం (దీన్నే *peek* అంటారు) +- **delete-max (లేదా delete-min):** max heap (లేదా min heap) root node ని తీసేయడం +- **insert:** heap లో కొత్త key కలపడం (దీన్నే *push* అంటారు) +- **increase-key లేదా decrease-key:** max- లేదా min-heap లో ఒక key ని update చేయడం +- **meld:** రెండు heaps ని కలిపి, రెండిట్లో ఉన్న అన్ని elements తో ఒక కొత్త valid heap తయారుచేయడం — పాత heaps పోతాయి. + +> ఈ repository లో [MaxHeap.js](./MaxHeap.js), [MinHeap.js](./MinHeap.js) అనేవి **Binary** heap కి examples. + +## Implementation + +- [MaxHeap.js](./MaxHeap.js), [MinHeap.js](./MinHeap.js) +- [MaxHeapAdhoc.js](./MaxHeapAdhoc.js), [MinHeapAdhoc.js](./MinHeapAdhoc.js) - MinHeap/MaxHeap data structure యొక్క చిన్న (ad hoc) version — దీనికి బయటి dependencies ఏమీ లేవు, coding interview లో interviewer ఒప్పుకుంటే ఈజీగా copy-paste చేసి వాడుకోవచ్చు (ఎందుకంటే JS లో చాలా data structures లేవు). + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Heap_(data_structure)) +- [YouTube](https://www.youtube.com/watch?v=t0Cq6tVNRBA&index=5&t=0s&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/data-structures/linked-list/README.es-ES.md b/src/data-structures/linked-list/README.es-ES.md index 6c6ba7ee87..49c6cb2440 100644 --- a/src/data-structures/linked-list/README.es-ES.md +++ b/src/data-structures/linked-list/README.es-ES.md @@ -5,7 +5,8 @@ _Lee este artículo en otros idiomas:_ [_Русский_](README.ru-RU.md), [_日本語_](README.ja-JP.md), [_Português_](README.pt-BR.md) -[_English_](README.md) +[_English_](README.md), +[_తెలుగు_](README.tel-IN.md) En ciencias de la computación una **lista enlazada** es una colección lineal de elementos, en los cuales el orden lineal no es dado por diff --git a/src/data-structures/linked-list/README.ko-KR.md b/src/data-structures/linked-list/README.ko-KR.md index f68d8a464d..4156eca54e 100644 --- a/src/data-structures/linked-list/README.ko-KR.md +++ b/src/data-structures/linked-list/README.ko-KR.md @@ -4,7 +4,8 @@ _Read this in other languages:_ [_简体中文_](README.zh-CN.md), [_Русский_](README.ru-RU.md), [_日本語_](README.ja-JP.md), -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) 컴퓨터과학에서, **링크드 리스트**는 데이터 요소의 선형 집합이며, 이 집합에서 논리적 저장 순서는 메모리의 물리적 저장 순서와 일치하지 않습니다. 그 대신, 각각의 원소들은 자기 자신 다음의 원소를 가리킵니다. **링크드 리스트**는 순서를 표현하는 노드들의 집합으로 이루어져 있습니다. 간단하게, 각각의 노드들은 데이터와 다음 순서의 노드를 가리키는 레퍼런스로 이루어져 있습니다. (링크라고 부릅니다.) 이 자료구조는 순회하는 동안 순서에 상관없이 효율적인 삽입이나 삭제가 가능합니다. 더 복잡한 변형은 추가적인 링크를 더해, 임의의 원소 참조로부터 효율적인 삽입과 삭제를 가능하게 합니다. 링크드 리스트의 단점은 접근 시간이 선형이라는 것이고, 병렬처리도 하지 못합니다. 임의 접근처럼 빠른 접근은 불가능합니다. 링크드 리스트에 비해 배열이 더 나은 캐시 지역성을 가지고 있습니다. diff --git a/src/data-structures/linked-list/README.md b/src/data-structures/linked-list/README.md index 825a0272f4..8555e92797 100644 --- a/src/data-structures/linked-list/README.md +++ b/src/data-structures/linked-list/README.md @@ -8,7 +8,8 @@ _Read this in other languages:_ [_한국어_](README.ko-KR.md), [_Español_](README.es-ES.md), [_Türkçe_](README.tr-TR.md), -[_Українська_](README.uk-UA.md) +[_Українська_](README.uk-UA.md), +[_తెలుగు_](README.tel-IN.md) In computer science, a **linked list** is a linear collection of data elements, in which linear order is not given by diff --git a/src/data-structures/linked-list/README.tel-IN.md b/src/data-structures/linked-list/README.tel-IN.md new file mode 100644 index 0000000000..8a1a421ca7 --- /dev/null +++ b/src/data-structures/linked-list/README.tel-IN.md @@ -0,0 +1,163 @@ +# Linked List + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_简体中文_](README.zh-CN.md), +[_Русский_](README.ru-RU.md), +[_日本語_](README.ja-JP.md), +[_Português_](README.pt-BR.md), +[_한국어_](README.ko-KR.md), +[_Español_](README.es-ES.md), +[_Türkçe_](README.tr-TR.md), +[_Українська_](README.uk-UA.md) + +Computer science లో **linked list** అనేది data elements ఉన్న ఒక linear collection — ఇందులో వరుస (linear +order) అనేది memory లో అవి ఎక్కడ ఉన్నాయో దాన్ని బట్టి రాదు. బదులుగా, ప్రతి element తర్వాత element ని +point చేస్తుంది. ఇది కొన్ని nodes ఉన్న data structure, ఆ nodes అన్నీ కలిసి ఒక sequence ని సూచిస్తాయి. అన్నిటికంటే +సింపుల్ రూపంలో, ప్రతి node లో data, ఇంకా sequence లో తర్వాత node కి ఒక reference (అంటే link) ఉంటాయి. ఈ +structure వల్ల iterate చేసేటప్పుడు sequence లో ఏ position నుంచైనా elements ని ఫాస్ట్ గా కలపొచ్చు, తీసేయొచ్చు. +ఇంకా కష్టమైన variants అదనపు links కలుపుతాయి — దాంతో ఏ element reference నుంచైనా ఫాస్ట్ గా కలపొచ్చు, +తీసేయొచ్చు. Linked lists లో ఒక లోపం ఏంటంటే access time linear (pipeline చేయడం కూడా కష్టం). Random access +లాంటి ఫాస్ట్ access కుదరదు. Linked lists తో పోలిస్తే arrays కి cache locality బెటర్ గా ఉంటుంది. + +![Linked List](./images/linked-list.jpeg) + +*[okso.app](https://okso.app) తో తయారుచేశారు* + +## Basic Operations కి Pseudocode + +### Insert + +```text +Add(value) + Pre: value is the value to add to the list + Post: value has been placed at the tail of the list + n ← node(value) + if head = ø + head ← n + tail ← n + else + tail.next ← n + tail ← n + end if +end Add +``` + +```text +Prepend(value) + Pre: value is the value to add to the list + Post: value has been placed at the head of the list + n ← node(value) + n.next ← head + head ← n + if tail = ø + tail ← n + end +end Prepend +``` + +### Search + +```text +Contains(head, value) + Pre: head is the head node in the list + value is the value to search for + Post: the item is either in the linked list, true; otherwise false + n ← head + while n != ø and n.value != value + n ← n.next + end while + if n = ø + return false + end if + return true +end Contains +``` + +### Delete + +```text +Remove(head, value) + Pre: head is the head node in the list + value is the value to remove from the list + Post: value is removed from the list, true, otherwise false + if head = ø + return false + end if + n ← head + if n.value = value + if head = tail + head ← ø + tail ← ø + else + head ← head.next + end if + return true + end if + while n.next != ø and n.next.value != value + n ← n.next + end while + if n.next != ø + if n.next = tail + tail ← n + tail.next = null + else + n.next ← n.next.next + end if + return true + end if + return false +end Remove +``` + +### Traverse + +```text +Traverse(head) + Pre: head is the head node in the list + Post: the items in the list have been traversed + n ← head + while n != ø + yield n.value + n ← n.next + end while +end Traverse +``` + +### Reverse లో Traverse + +```text +ReverseTraversal(head, tail) + Pre: head and tail belong to the same list + Post: the items in the list have been traversed in reverse order + if tail != ø + curr ← tail + while curr != head + prev ← head + while prev.next != curr + prev ← prev.next + end while + yield curr.value + curr ← prev + end while + yield curr.value + end if +end ReverseTraversal +``` + +## Complexities + +### Time Complexity + +| Access | Search | Insertion | Deletion | +| :-------: | :-------: | :-------: | :-------: | +| O(n) | O(n) | O(1) | O(n) | + +### Space Complexity + +O(n) + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Linked_list) +- [YouTube](https://www.youtube.com/watch?v=njTh_OwMljA&index=2&t=1s&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/data-structures/linked-list/README.tr-TR.md b/src/data-structures/linked-list/README.tr-TR.md index e5ed05623d..d64def3195 100644 --- a/src/data-structures/linked-list/README.tr-TR.md +++ b/src/data-structures/linked-list/README.tr-TR.md @@ -7,6 +7,7 @@ _Bunu diğer dillerde okuyun:_ [_Português_](README.pt-BR.md), [_한국어_](README.ko-KR.md), [_Español_](README.es-ES.md), +[_తెలుగు_](README.tel-IN.md) Bilgisayar bilimlerinde, **Bağlantılı liste**, her biri hem gerçek verileri hem de listedeki bir sonraki düğümün bir bağlantısını içeren dinamik bir diff --git a/src/data-structures/linked-list/README.vi-VN.md b/src/data-structures/linked-list/README.vi-VN.md index 005838c6c1..fc6443b2ac 100644 --- a/src/data-structures/linked-list/README.vi-VN.md +++ b/src/data-structures/linked-list/README.vi-VN.md @@ -8,7 +8,8 @@ _Đọc bằng ngôn ngữ khác:_ [_한국어_](README.ko-KR.md), [_Español_](README.es-ES.md), [_Türkçe_](README.tr-TR.md), -[_Українська_](README.uk-UA.md) +[_Українська_](README.uk-UA.md), +[_తెలుగు_](README.tel-IN.md) Trong khoa học máy tính, một danh sách liên kết là một bộ sưu tập tuyến tính diff --git a/src/data-structures/lru-cache/README.md b/src/data-structures/lru-cache/README.md index eaa075f809..bf2290cae2 100644 --- a/src/data-structures/lru-cache/README.md +++ b/src/data-structures/lru-cache/README.md @@ -2,6 +2,7 @@ _Read this in other languages:_ [한국어](README.ko-KR.md), +[_తెలుగు_](README.tel-IN.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. diff --git a/src/data-structures/lru-cache/README.tel-IN.md b/src/data-structures/lru-cache/README.tel-IN.md new file mode 100644 index 0000000000..da1e8ea791 --- /dev/null +++ b/src/data-structures/lru-cache/README.tel-IN.md @@ -0,0 +1,55 @@ +# Least Recently Used (LRU) Cache + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_한국어_](README.ko-KR.md) + +**Least Recently Used (LRU) Cache** items ని వాడిన order లో సర్దుతుంది — దాంతో అన్నిటికంటే ఎక్కువ టైమ్ నుంచి ఏ item వాడలేదో ఫాస్ట్ గా కనుక్కోవచ్చు. + +ఒక బట్టల stand (rack) ఊహించుకోండి — బట్టలు ఎప్పుడూ ఒక వైపే తగిలిస్తారు. అన్నిటికంటే ముందు వాడిన (least-recently used) item కనుక్కోవాలంటే, rack కి ఇంకో చివర ఉన్న item చూడండి. + +## Problem statement + +LRUCache class ని implement చేయండి: + +- `LRUCache(int capacity)` LRU cache ని **positive** సైజ్ `capacity` తో initialize చేయండి. +- `int get(int key)` `key` ఉంటే దాని value return చేయండి, లేకపోతే `undefined` return చేయండి. +- `void set(int key, int value)` `key` ఉంటే దాని value update చేయండి. లేకపోతే, `key-value` pair ని cache లో కలపండి. ఈ operation వల్ల keys సంఖ్య `capacity` దాటితే, least recently used key ని **బయటికి పంపండి (evict)**. + +`get()`, `set()` functions ఒక్కోటి `O(1)` average time complexity లో రన్ అవ్వాలి. + +## Implementation + +### Version 1: Doubly Linked List + Hash Map + +`LRUCache` implementation example కోసం [LRUCache.js](./LRUCache.js) చూడండి. ఈ solution లో cache items ని ఫాస్ట్ గా `O(1)` (average) లో access చేయడానికి `HashMap`, cache items ని ఫాస్ట్ గా `O(1)` (average) లో promote చేయడానికి, బయటికి పంపడానికి (maximum cache capacity దాటకుండా ఉంచడానికి) `DoublyLinkedList` వాడారు. + +![Linked List](./images/lru-cache.jpg) + +_[okso.app](https://okso.app) తో తయారుచేశారు_ + +LRU Cache ఎలా పనిచేస్తుందో ఇంకా test-case examples [LRUCache.test.js](./__test__/LRUCache.test.js) file లో చూడొచ్చు. + +### Version 2: Ordered Map + +Doubly linked list వాడే మొదటి implementation నేర్చుకోడానికి బాగుంటుంది, ఇంకా `set()`, `get()` చేసేటప్పుడు average `O(1)` time complexity ఎలా వస్తుందో బాగా అర్థమవుతుంది. + +కానీ, ఇంకా సింపుల్ పద్ధతి ఏంటంటే JavaScript [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) object వాడటం. `Map` object key-value pairs ని ఉంచుతుంది, ఇంకా keys ని **ఏ order లో insert చేశామో గుర్తుపెట్టుకుంటుంది**. ఈ విషయాన్ని వాడుకుని, items ని తీసేసి మళ్ళీ కలుపుతూ, recently-used items ని map "చివర్లో" ఉంచొచ్చు. Cache capacity దాటితే `Map` మొదట్లో ఉన్న item నే ముందు బయటికి పోతుంది. Items order ని `map.keys()` లాంటి `IterableIterator` తో చెక్ చేయొచ్చు. + +`LRUCacheOnMap` implementation example కోసం [LRUCacheOnMap.js](./LRUCacheOnMap.js) చూడండి. + +LRU Cache ఎలా పనిచేస్తుందో ఇంకా test-case examples [LRUCacheOnMap.test.js](./__test__/LRUCacheOnMap.test.js) file లో చూడొచ్చు. + +## Complexities + +| | Average | +| -------- | ------- | +| Space | `O(n)` | +| Get item | `O(1)` | +| Set item | `O(1)` | + +## References + +- [LeetCode లో LRU Cache](https://leetcode.com/problems/lru-cache/solutions/244744/lru-cache/) +- [InterviewCake లో LRU Cache](https://www.interviewcake.com/concept/java/lru-cache) +- [Wiki లో LRU Cache](https://en.wikipedia.org/wiki/Cache_replacement_policies) diff --git a/src/data-structures/priority-queue/README.md b/src/data-structures/priority-queue/README.md index 6d0901960d..9043c7cee1 100644 --- a/src/data-structures/priority-queue/README.md +++ b/src/data-structures/priority-queue/README.md @@ -7,7 +7,8 @@ _Read this in other languages:_ [_Français_](README.fr-FR.md), [_Português_](README.pt-BR.md), [_한국어_](README.ko-KR.md), -[_Українська_](README.uk-UA.md) +[_Українська_](README.uk-UA.md), +[_తెలుగు_](README.tel-IN.md) In computer science, a **priority queue** is an abstract data type which is like a regular queue or stack data structure, but where diff --git a/src/data-structures/priority-queue/README.tel-IN.md b/src/data-structures/priority-queue/README.tel-IN.md new file mode 100644 index 0000000000..6acc51b821 --- /dev/null +++ b/src/data-structures/priority-queue/README.tel-IN.md @@ -0,0 +1,26 @@ +# Priority Queue + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_简体中文_](README.zh-CN.md), +[_Русский_](README.ru-RU.md), +[_日本語_](README.ja-JP.md), +[_Français_](README.fr-FR.md), +[_Português_](README.pt-BR.md), +[_한국어_](README.ko-KR.md), +[_Українська_](README.uk-UA.md) + +Computer science లో **priority queue** అనేది ఒక abstract data type — ఇది మామూలు queue లేదా stack +data structure లాంటిదే, కానీ అదనంగా ప్రతి element కి ఒక "priority" (ప్రాధాన్యత) ఉంటుంది. Priority +queue లో, ఎక్కువ priority ఉన్న element ని తక్కువ priority ఉన్న element కంటే ముందు serve చేస్తారు. +రెండు elements కి ఒకే priority ఉంటే, queue లో వాటి order ప్రకారం serve చేస్తారు. + +Priority queues ని ఎక్కువగా heaps తో implement చేస్తారు కానీ, concept పరంగా అవి heaps కంటే వేరు. +Priority queue అనేది "list" లేదా "map" లాంటి ఒక abstract concept; ఒక list ని linked list తో గానీ array +తో గానీ implement చేయొచ్చు, అలాగే priority queue ని heap తో గానీ, unordered array లాంటి వేరే చాలా +పద్ధతులతో గానీ implement చేయొచ్చు. + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Priority_queue) +- [YouTube](https://www.youtube.com/watch?v=wptevk0bshY&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&index=6) diff --git a/src/data-structures/queue/README.ko-KR.md b/src/data-structures/queue/README.ko-KR.md index 606c8ff35e..36d84058d5 100644 --- a/src/data-structures/queue/README.ko-KR.md +++ b/src/data-structures/queue/README.ko-KR.md @@ -5,7 +5,8 @@ _Read this in other languages:_ [_Русский_](README.ru-RU.md), [_日本語_](README.ja-JP.md), [_Français_](README.fr-FR.md), -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) 컴퓨터 공학에서 **큐**는 일종의 추상 데이터 타입이자 컬렉션입니다. 큐 내부의 엔터티들은 순서를 유지하며 컬렉션의 가장 뒷 부분에 엔터티를 추가하는 인큐(enqueue), 컬렉션의 가장 앞에 위치한 엔터티를 제거하는 디큐(dequeue) 작업을 수행합니다. 이것은 큐를 선입선출 자료 구조로 만듭니다. 선입선출 자료 구조에서는, 추가된 첫 번째 요소가 가장 먼저 제거되는 요소가 됩니다. 이는 새로운 요소가 추가되면 이전에 추가되었던 모든 요소들을 제거해야 새로운 요소를 제거할 수 있다는것과 같은 의미입니다. 또한 큐의 가장 앞에 위치한 요소를 반환하기 위한 작업이 입력되면 디큐 작업 없이 해당 요소를 반환합니다. diff --git a/src/data-structures/queue/README.md b/src/data-structures/queue/README.md index d8e0288b42..91fb7bb401 100644 --- a/src/data-structures/queue/README.md +++ b/src/data-structures/queue/README.md @@ -7,7 +7,8 @@ _Read this in other languages:_ [_Français_](README.fr-FR.md), [_Português_](README.pt-BR.md), [_한국어_](README.ko-KR.md), -[_Українська_](README.uk-UA.md) +[_Українська_](README.uk-UA.md), +[_తెలుగు_](README.tel-IN.md) In computer science, a **queue** is a particular kind of abstract data type or collection in which the entities in the collection are diff --git a/src/data-structures/queue/README.tel-IN.md b/src/data-structures/queue/README.tel-IN.md new file mode 100644 index 0000000000..cccbef264a --- /dev/null +++ b/src/data-structures/queue/README.tel-IN.md @@ -0,0 +1,33 @@ +# Queue + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_简体中文_](README.zh-CN.md), +[_Русский_](README.ru-RU.md), +[_日本語_](README.ja-JP.md), +[_Français_](README.fr-FR.md), +[_Português_](README.pt-BR.md), +[_한국어_](README.ko-KR.md), +[_Українська_](README.uk-UA.md) + +Computer science లో **queue** (క్యూ / వరుస) అనేది ఒక ప్రత్యేక రకమైన abstract data type లేదా collection. +ఇందులో entities ని order లో ఉంచుతారు, ఇంకా collection మీద ముఖ్యమైన (లేదా ఒకే) operations ఏంటంటే — +వెనక చివరికి entities కలపడం (దీన్ని enqueue అంటారు), ముందు చివర నుంచి entities తీసేయడం (దీన్ని +dequeue అంటారు). అందుకే queue ని First-In-First-Out (FIFO) data structure అంటారు. FIFO data structure +లో, queue లో మొదట కలిపిన element నే మొదట తీసేస్తారు. అంటే ఒక కొత్త element కలిపాక, ఆ కొత్త element ని +తీసేయాలంటే, దానికంటే ముందు కలిపిన elements అన్నీ ముందే తీసేయాలి. చాలాసార్లు peek లేదా front అనే +operation కూడా ఉంటుంది — ఇది ముందు ఉన్న element ని తీసేయకుండా దాని value ఇస్తుంది. Queue అనేది +linear data structure కి, లేదా ఇంకా abstract గా చెప్పాలంటే sequential collection కి ఒక ఉదాహరణ. + +సినిమా టికెట్ల క్యూ లాగే — ముందు వచ్చిన వాళ్ళకే ముందు టికెట్. + +FIFO (first in, first out) queue ని ఇలా చూపించొచ్చు + +![Queue](./images/queue.jpeg) + +*[okso.app](https://okso.app) తో తయారుచేశారు* + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Queue_(abstract_data_type)) +- [YouTube](https://www.youtube.com/watch?v=wjI1WNcIntg&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&index=3&) diff --git a/src/data-structures/queue/README.vi-VN.md b/src/data-structures/queue/README.vi-VN.md index 84b3bdbfa6..325ad1fc6d 100644 --- a/src/data-structures/queue/README.vi-VN.md +++ b/src/data-structures/queue/README.vi-VN.md @@ -6,7 +6,8 @@ _Đọc bằng ngôn ngữ khác:_ [_日本語_](README.ja-JP.md), [_Português_](README.pt-BR.md), [_한국어_](README.ko-KR.md), -[_Українська_](README.uk-UA.md) +[_Українська_](README.uk-UA.md), +[_తెలుగు_](README.tel-IN.md) Trong khoa học máy tính, một **hàng đợi** là một loại cụ thể của kiểu dữ liệu trừu tượng hoặc bộ sưu tập trong đó các phần tử trong bộ sưu tập được giữ theo thứ tự và nguyên tắc (hoặc chỉ) các hoạt động trên bộ sưu tập là thêm các phần tử vào vị trí cuối cùng, được gọi là đưa vào hàng đợi (enqueue), và loại bỏ các phần tử từ vị trí đầu tiên, được gọi là đưa ra khỏi hàng đợi (dequeue). Điều này khiến cho hàng đợi trở thành một cấu trúc dữ liệu First-In-First-Out (FIFO). Trong cấu trúc dữ liệu FIFO, phần tử đầu tiên được thêm vào hàng đợi sẽ là phần tử đầu tiên được loại bỏ. Điều này tương đương với yêu cầu rằng sau khi một phần tử mới được thêm vào, tất cả các phần tử đã được thêm vào trước đó phải được loại bỏ trước khi có thể loại bỏ phần tử mới. Thường thì cũng có thêm một hoạt động nhìn hay lấy phần đầu, trả về giá trị của phần tử đầu tiên mà không loại bỏ nó. Hàng đợi là một ví dụ về cấu trúc dữ liệu tuyến tính, hoặc trừu tượng hơn là một bộ sưu tập tuần tự. diff --git a/src/data-structures/stack/README.ko-KR.md b/src/data-structures/stack/README.ko-KR.md index c36a472e66..1e62640eeb 100644 --- a/src/data-structures/stack/README.ko-KR.md +++ b/src/data-structures/stack/README.ko-KR.md @@ -5,7 +5,8 @@ _Read this in other languages:_ [_Русский_](README.ru-RU.md), [_日本語_](README.ja-JP.md), [_Français_](README.fr-FR.md), -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) 컴퓨터 과학에서, **스택**은 아래의 두가지 연산을 가진 요소들의 집합인 추상 자료형입니다. diff --git a/src/data-structures/stack/README.md b/src/data-structures/stack/README.md index 612f926736..f81e8ccadb 100644 --- a/src/data-structures/stack/README.md +++ b/src/data-structures/stack/README.md @@ -7,7 +7,8 @@ _Read this in other languages:_ [_Français_](README.fr-FR.md), [_Português_](README.pt-BR.md), [_한국어_](README.ko-KR.md), -[_Українська_](README.uk-UA.md) +[_Українська_](README.uk-UA.md), +[_తెలుగు_](README.tel-IN.md) In computer science, a **stack** is an abstract data type that serves as a collection of elements, with two principal operations: diff --git a/src/data-structures/stack/README.tel-IN.md b/src/data-structures/stack/README.tel-IN.md new file mode 100644 index 0000000000..f1f8963ee9 --- /dev/null +++ b/src/data-structures/stack/README.tel-IN.md @@ -0,0 +1,36 @@ +# Stack + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_简体中文_](README.zh-CN.md), +[_Русский_](README.ru-RU.md), +[_日本語_](README.ja-JP.md), +[_Français_](README.fr-FR.md), +[_Português_](README.pt-BR.md), +[_한국어_](README.ko-KR.md), +[_Українська_](README.uk-UA.md) + +Computer science లో **stack** అనేది elements collection గా పనిచేసే ఒక abstract data type, దీనికి రెండు +ముఖ్యమైన operations ఉంటాయి: + +* **push** — collection లో ఒక element కలుపుతుంది, ఇంకా +* **pop** — ఇంకా తీసేయని elements లో అన్నిటికంటే చివరగా కలిపిన element ని తీసేస్తుంది. + +Stack నుంచి elements బయటికి వచ్చే order వల్లే దీనికి LIFO (last in, first out — చివర వచ్చింది ముందు +పోతుంది) అనే ఇంకో పేరు వచ్చింది. అదనంగా, peek operation stack ని మార్చకుండా పైన ఉన్న దాన్ని +చూపిస్తుంది. ఈ రకమైన structure కి "stack" అనే పేరు, ఒకదానిమీద ఒకటి పేర్చిన వస్తువుల నుంచి వచ్చింది — +అలా పేర్చినప్పుడు పైన ఉన్న వస్తువుని తీయడం ఈజీ, కానీ stack లో లోతుగా ఉన్న వస్తువుని తీయాలంటే ముందు +పైన ఉన్న చాలా వస్తువులని తీయాల్సి రావొచ్చు. + +ఒకదానిమీద ఒకటి పేర్చిన ప్లేట్ల లాగే — చివరగా పెట్టిన ప్లేటే ముందు తీస్తాం. + +Push, pop operations తో stack runtime ని సింపుల్ గా ఇలా చూపించొచ్చు. + +![Stack](./images/stack.jpeg) + +*[okso.app](https://okso.app) తో తయారుచేశారు* + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Stack_(abstract_data_type)) +- [YouTube](https://www.youtube.com/watch?v=wjI1WNcIntg&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&index=3&) diff --git a/src/data-structures/stack/README.vi-VN.md b/src/data-structures/stack/README.vi-VN.md index f051f3201f..0f50abfc3f 100644 --- a/src/data-structures/stack/README.vi-VN.md +++ b/src/data-structures/stack/README.vi-VN.md @@ -7,7 +7,8 @@ _Đọc bằng ngôn ngữ khác:_ [_Português_](README.pt-BR.md), [_한국어_](README.ko-KR.md), [_Español_](README.es-ES.md), -[_Українська_](README.uk-UA.md) +[_Українська_](README.uk-UA.md), +[_తెలుగు_](README.tel-IN.md) Trong khoa học máy tính, một ngăn xếp (stack) là một kiểu dữ liệu trừu tượng phục vụ như một bộ sưu tập các phần tử, với hai hoạt động chính: diff --git a/src/data-structures/tree/README.md b/src/data-structures/tree/README.md index e492257d33..7419c05c46 100644 --- a/src/data-structures/tree/README.md +++ b/src/data-structures/tree/README.md @@ -2,7 +2,8 @@ _Read this in other languages:_ [_简体中文_](README.zh-CN.md), -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) * [Binary Search Tree](binary-search-tree) * [AVL Tree](avl-tree) diff --git a/src/data-structures/tree/README.tel-IN.md b/src/data-structures/tree/README.tel-IN.md new file mode 100644 index 0000000000..6fcc665e09 --- /dev/null +++ b/src/data-structures/tree/README.tel-IN.md @@ -0,0 +1,32 @@ +# Tree + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_简体中文_](README.zh-CN.md), +[_Português_](README.pt-BR.md) + +* [Binary Search Tree](binary-search-tree) +* [AVL Tree](avl-tree) +* [Red-Black Tree](red-black-tree) +* [Segment Tree](segment-tree) - min/max/sum range queries examples తో +* [Fenwick Tree](fenwick-tree) (Binary Indexed Tree) + +Computer science లో **tree** అనేది బాగా వాడే abstract data type (ADT) — లేదా ఈ ADT ని implement చేసే +data structure. ఇది ఒక hierarchical (అంచెలంచెలుగా ఉండే) చెట్టు structure లాగా పనిచేస్తుంది — ఒక root value, +ఇంకా parent node కింద children subtrees ఉంటాయి, వీటిని linked nodes set గా చూపిస్తారు. + +Tree data structure ని recursive గా (locally) ఇలా define చేయొచ్చు — nodes collection (root node నుంచి +మొదలయ్యేది), ఇందులో ప్రతి node ఒక value, ఇంకా nodes కి references list ("children") ఉన్న data structure. +Conditions ఏంటంటే — ఏ reference కూడా రెండుసార్లు ఉండకూడదు, ఏదీ root ని point చేయకూడదు. + +ఒక సింపుల్ unordered tree; ఈ diagram లో, 3 అని label ఉన్న node కి 2, 6 అని label ఉన్న ఇద్దరు children, +2 అని label ఉన్న ఒక parent ఉన్నారు. పైన ఉన్న root node కి parent లేదు. + +![Tree](./images/tree.jpeg) + +*[okso.app](https://okso.app) తో తయారుచేశారు* + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Tree_(data_structure)) +- [YouTube](https://www.youtube.com/watch?v=oSWTXtMglKE&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&index=8) diff --git a/src/data-structures/tree/avl-tree/README.md b/src/data-structures/tree/avl-tree/README.md index c70fca7bcd..76464d8aed 100644 --- a/src/data-structures/tree/avl-tree/README.md +++ b/src/data-structures/tree/avl-tree/README.md @@ -1,7 +1,8 @@ # AVL Tree _Read this in other languages:_ -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) In computer science, an **AVL tree** (named after inventors Adelson-Velsky and Landis) is a self-balancing binary search diff --git a/src/data-structures/tree/avl-tree/README.tel-IN.md b/src/data-structures/tree/avl-tree/README.tel-IN.md new file mode 100644 index 0000000000..a3998106e8 --- /dev/null +++ b/src/data-structures/tree/avl-tree/README.tel-IN.md @@ -0,0 +1,48 @@ +# AVL Tree + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Português_](README.pt-BR.md) + +Computer science లో **AVL tree** (కనిపెట్టిన Adelson-Velsky, Landis పేర్ల మీద వచ్చింది) అనేది +తనని తానే balance చేసుకునే binary search tree. ఇలాంటి data structure లలో మొదట కనిపెట్టింది ఇదే. +AVL tree లో, ఏ node కైనా దాని రెండు child subtrees ఎత్తుల మధ్య తేడా మహా అయితే ఒకటి; ఎప్పుడైనా +తేడా ఒకటి కంటే ఎక్కువ అయితే, ఈ property మళ్ళీ రావడానికి rebalancing చేస్తారు. Lookup, insertion, +deletion — ఇవన్నీ average, worst cases రెండిట్లోనూ `O(log n)` టైమ్ తీసుకుంటాయి, ఇక్కడ n అంటే operation +ముందు tree లో ఉన్న nodes సంఖ్య. Insertions, deletions తర్వాత tree ని ఒకటి లేదా అంతకంటే ఎక్కువ tree +rotations తో rebalance చేయాల్సి రావొచ్చు. + +AVL tree లో చాలా elements insert చేయడాన్ని చూపించే animation. ఇందులో left, right, left-right, +right-left rotations ఉన్నాయి. + +![AVL Tree](https://upload.wikimedia.org/wikipedia/commons/f/fd/AVL_Tree_Example.gif) + +Balance factors (ఆకుపచ్చ) తో AVL tree + +![AVL Tree](https://upload.wikimedia.org/wikipedia/commons/a/ad/AVL-tree-wBalance_K.svg) + +### AVL Tree Rotations + +**Left-Left Rotation** + +![Left-Left Rotation](http://btechsmartclass.com/data_structures/ds_images/LL%20Rotation.png) + +**Right-Right Rotation** + +![Right-Right Rotation](http://btechsmartclass.com/data_structures/ds_images/RR%20Rotation.png) + +**Left-Right Rotation** + +![Left-Right Rotation](http://btechsmartclass.com/data_structures/ds_images/LR%20Rotation.png) + +**Right-Left Rotation** + +![Right-Right Rotation](http://btechsmartclass.com/data_structures/ds_images/RL%20Rotation.png) + +## References + +* [Wikipedia](https://en.wikipedia.org/wiki/AVL_tree) +* [Tutorials Point](https://www.tutorialspoint.com/data_structures_algorithms/avl_tree_algorithm.htm) +* [BTech](http://btechsmartclass.com/data_structures/avl-trees.html) +* [YouTube లో AVL Tree Insertion](https://www.youtube.com/watch?v=rbg7Qf8GkQ4&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&index=12&) +* [AVL Tree Interactive Visualisations](https://www.cs.usfca.edu/~galles/visualization/AVLtree.html) diff --git a/src/data-structures/tree/binary-search-tree/README.md b/src/data-structures/tree/binary-search-tree/README.md index d05a891545..1001fb50a8 100644 --- a/src/data-structures/tree/binary-search-tree/README.md +++ b/src/data-structures/tree/binary-search-tree/README.md @@ -1,7 +1,8 @@ # Binary Search Tree _Read this in other languages:_ -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) In computer science, **binary search trees** (BST), sometimes called ordered or sorted binary trees, are a particular type of container: diff --git a/src/data-structures/tree/binary-search-tree/README.tel-IN.md b/src/data-structures/tree/binary-search-tree/README.tel-IN.md new file mode 100644 index 0000000000..2d0e6a6f7e --- /dev/null +++ b/src/data-structures/tree/binary-search-tree/README.tel-IN.md @@ -0,0 +1,272 @@ +# Binary Search Tree + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Português_](README.pt-BR.md) + +Computer science లో **binary search trees** (BST) — కొన్నిసార్లు ordered లేదా sorted binary trees అని +కూడా అంటారు — అనేవి ఒక ప్రత్యేక రకమైన container: memory లో "items" (numbers, పేర్లు లాంటివి) store +చేసే data structures. ఇవి items ని ఫాస్ట్ గా వెతకడానికి, కలపడానికి, తీసేయడానికి ఉపయోగపడతాయి, ఇంకా +items dynamic sets ని గానీ, key తో item కనుక్కునే lookup tables ని గానీ (ఉదాహరణకి, పేరు తో ఒక వ్యక్తి phone +number కనుక్కోవడం) implement చేయడానికి వాడొచ్చు. + +Binary search trees తమ keys ని sorted order లో ఉంచుతాయి — దాంతో lookup, ఇంకా వేరే operations binary +search సూత్రాన్ని వాడుకోవచ్చు: tree లో ఒక key కోసం (లేదా కొత్త key పెట్టడానికి చోటు కోసం) వెతికేటప్పుడు, +root నుంచి leaf వరకు tree ని traverse చేస్తాయి — tree nodes లో store అయిన keys తో compare చేస్తూ, ఆ +compare ని బట్టి left subtree లో వెతకాలా right subtree లో వెతకాలా నిర్ణయిస్తాయి. Average గా, ప్రతి compare +తో tree లో దాదాపు సగం skip అవుతుంది — కాబట్టి ప్రతి lookup, insertion, deletion కి tree లో store అయిన items +సంఖ్య logarithm కి proportional టైమ్ పడుతుంది. (Sort కాని) array లో key తో items కనుక్కోవడానికి పట్టే linear +time కంటే ఇది చాలా బెటర్, కానీ hash tables మీద అవే operations కంటే slow. + +సైజ్ 9, depth 3 ఉన్న binary search tree, root లో 8 ఉంది. Leaves ని గీయలేదు. + +![Trie](./images/binary-search-tree.jpg) + +*[okso.app](https://okso.app) తో తయారుచేశారు* + +## Basic Operations కి Pseudocode + +### Insertion + +```text +insert(value) + Pre: value has passed custom type checks for type T + Post: value has been placed in the correct location in the tree + if root = ø + root ← node(value) + else + insertNode(root, value) + end if +end insert +``` + +```text +insertNode(current, value) + Pre: current is the node to start from + Post: value has been placed in the correct location in the tree + if value < current.value + if current.left = ø + current.left ← node(value) + else + InsertNode(current.left, value) + end if + else + if current.right = ø + current.right ← node(value) + else + InsertNode(current.right, value) + end if + end if +end insertNode +``` + +### Searching + +```text +contains(root, value) + Pre: root is the root node of the tree, value is what we would like to locate + Post: value is either located or not + if root = ø + return false + end if + if root.value = value + return true + else if value < root.value + return contains(root.left, value) + else + return contains(root.right, value) + end if +end contains +``` + + +### Deletion + +```text +remove(value) + Pre: value is the value of the node to remove, root is the node of the BST + count is the number of items in the BST + Post: node with value is removed if found in which case yields true, otherwise false + nodeToRemove ← findNode(value) + if nodeToRemove = ø + return false + end if + parent ← findParent(value) + if count = 1 + root ← ø + else if nodeToRemove.left = ø and nodeToRemove.right = ø + if nodeToRemove.value < parent.value + parent.left ← nodeToRemove.right + else + parent.right ← nodeToRemove.right + end if + else if nodeToRemove.left != ø and nodeToRemove.right != ø + next ← nodeToRemove.right + while next.left != ø + next ← next.left + end while + if next != nodeToRemove.right + remove(next.value) + nodeToRemove.value ← next.value + else + nodeToRemove.value ← next.value + nodeToRemove.right ← nodeToRemove.right.right + end if + else + if nodeToRemove.left = ø + next ← nodeToRemove.right + else + next ← nodeToRemove.left + end if + if root = nodeToRemove + root = next + else if parent.left = nodeToRemove + parent.left = next + else if parent.right = nodeToRemove + parent.right = next + end if + end if + count ← count - 1 + return true +end remove +``` + +### Node యొక్క Parent కనుక్కోవడం + +```text +findParent(value, root) + Pre: value is the value of the node we want to find the parent of + root is the root node of the BST and is != ø + Post: a reference to the prent node of value if found; otherwise ø + if value = root.value + return ø + end if + if value < root.value + if root.left = ø + return ø + else if root.left.value = value + return root + else + return findParent(value, root.left) + end if + else + if root.right = ø + return ø + else if root.right.value = value + return root + else + return findParent(value, root.right) + end if + end if +end findParent +``` + +### Node కనుక్కోవడం + +```text +findNode(root, value) + Pre: value is the value of the node we want to find the parent of + root is the root node of the BST + Post: a reference to the node of value if found; otherwise ø + if root = ø + return ø + end if + if root.value = value + return root + else if value < root.value + return findNode(root.left, value) + else + return findNode(root.right, value) + end if +end findNode +``` + +### Minimum కనుక్కోవడం + +```text +findMin(root) + Pre: root is the root node of the BST + root = ø + Post: the smallest value in the BST is located + if root.left = ø + return root.value + end if + findMin(root.left) +end findMin +``` + +### Maximum కనుక్కోవడం + +```text +findMax(root) + Pre: root is the root node of the BST + root = ø + Post: the largest value in the BST is located + if root.right = ø + return root.value + end if + findMax(root.right) +end findMax +``` + +### Traversal + +#### InOrder Traversal + +```text +inorder(root) + Pre: root is the root node of the BST + Post: the nodes in the BST have been visited in inorder + if root != ø + inorder(root.left) + yield root.value + inorder(root.right) + end if +end inorder +``` + +#### PreOrder Traversal + +```text +preorder(root) + Pre: root is the root node of the BST + Post: the nodes in the BST have been visited in preorder + if root != ø + yield root.value + preorder(root.left) + preorder(root.right) + end if +end preorder +``` + +#### PostOrder Traversal + +```text +postorder(root) + Pre: root is the root node of the BST + Post: the nodes in the BST have been visited in postorder + if root != ø + postorder(root.left) + postorder(root.right) + yield root.value + end if +end postorder +``` + +## Complexities + +### Time Complexity + +| Access | Search | Insertion | Deletion | +| :-------: | :-------: | :-------: | :-------: | +| O(log(n)) | O(log(n)) | O(log(n)) | O(log(n)) | + +### Space Complexity + +O(n) + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Binary_search_tree) +- [YouTube లో BST లో Insert చేయడం](https://www.youtube.com/watch?v=wcIRPqTR3Kc&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&index=9&t=0s) +- [BST Interactive Visualisations](https://www.cs.usfca.edu/~galles/visualization/BST.html) diff --git a/src/data-structures/tree/fenwick-tree/README.md b/src/data-structures/tree/fenwick-tree/README.md index 14129caa7c..6fac77a34f 100644 --- a/src/data-structures/tree/fenwick-tree/README.md +++ b/src/data-structures/tree/fenwick-tree/README.md @@ -1,7 +1,8 @@ # Fenwick Tree / Binary Indexed Tree _Read this in other languages:_ -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) A **Fenwick tree** or **binary indexed tree** is a data structure that can efficiently update elements and diff --git a/src/data-structures/tree/fenwick-tree/README.tel-IN.md b/src/data-structures/tree/fenwick-tree/README.tel-IN.md new file mode 100644 index 0000000000..48a628aa0b --- /dev/null +++ b/src/data-structures/tree/fenwick-tree/README.tel-IN.md @@ -0,0 +1,35 @@ +# Fenwick Tree / Binary Indexed Tree + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Português_](README.pt-BR.md) + +**Fenwick tree** లేదా **binary indexed tree** అనేది నంబర్ల table లో elements ని ఫాస్ట్ గా update +చేయగలిగే, prefix sums (మొదటి నుంచి ఒక point వరకు మొత్తం) ఫాస్ట్ గా లెక్కపెట్టగలిగే data structure. + +మామూలు flat array తో పోలిస్తే, Fenwick tree రెండు operations మధ్య చాలా బెటర్ balance ఇస్తుంది: element +update, prefix sum లెక్క. `n` నంబర్లు ఉన్న flat array లో, elements ని గానీ prefix sums ని గానీ store +చేయొచ్చు. మొదటి case లో prefix sums లెక్కపెట్టడానికి linear time పడుతుంది; రెండో case లో array elements +update చేయడానికి linear time పడుతుంది (రెండు cases లోనూ ఇంకో operation constant time లో చేయొచ్చు). +Fenwick trees తో రెండు operations `O(log n)` టైమ్ లో చేయొచ్చు. నంబర్లని ఒక tree గా చూపించడం వల్ల ఇది +కుదురుతుంది — ప్రతి node value అంటే ఆ subtree లో ఉన్న నంబర్ల మొత్తం. ఈ tree structure వల్ల కేవలం +`O(log n)` node accesses తో operations చేయొచ్చు. + +## Implementation Notes + +Binary Indexed Tree ని ఒక array గా చూపిస్తారు. Binary Indexed Tree లో ప్రతి node, ఇచ్చిన array లో కొన్ని +elements మొత్తాన్ని store చేస్తుంది. Binary Indexed Tree సైజ్ `n`, ఇక్కడ `n` అంటే input array సైజ్. ఇప్పటి +implementation లో ఈజీగా ఉండటానికి సైజ్ `n+1` వాడాం. అన్ని indexes 1 నుంచి మొదలవుతాయి (1-based). + +![Binary Indexed Tree](https://www.geeksforgeeks.org/wp-content/uploads/BITSum.png) + +కింద బొమ్మలో, `[1, 2, 3, 4, 5]` array కి ఒక్కొక్కటిగా insert చేస్తూ binary indexed tree తయారుచేయడాన్ని +animated example గా చూడొచ్చు. + +![Fenwick Tree](https://upload.wikimedia.org/wikipedia/commons/d/dc/BITDemo.gif) + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Fenwick_tree) +- [GeeksForGeeks](https://www.geeksforgeeks.org/binary-indexed-tree-or-fenwick-tree-2/) +- [YouTube](https://www.youtube.com/watch?v=CWDQJGaN1gY&index=18&t=0s&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) diff --git a/src/data-structures/tree/red-black-tree/README.md b/src/data-structures/tree/red-black-tree/README.md index 566089f976..ecb49331a6 100644 --- a/src/data-structures/tree/red-black-tree/README.md +++ b/src/data-structures/tree/red-black-tree/README.md @@ -1,7 +1,8 @@ # Red–Black Tree _Read this in other languages:_ -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) A **red–black tree** is a kind of self-balancing binary search tree in computer science. Each node of the binary tree has diff --git a/src/data-structures/tree/red-black-tree/README.tel-IN.md b/src/data-structures/tree/red-black-tree/README.tel-IN.md new file mode 100644 index 0000000000..ff539f7f13 --- /dev/null +++ b/src/data-structures/tree/red-black-tree/README.tel-IN.md @@ -0,0 +1,80 @@ +# Red–Black Tree + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Português_](README.pt-BR.md) + +Computer science లో **red–black tree** అనేది తనని తానే balance చేసుకునే ఒక రకమైన binary search tree. +Binary tree లో ప్రతి node కి ఒక అదనపు bit ఉంటుంది, ఆ bit ని మామూలుగా node color (ఎరుపు లేదా నలుపు) +గా చూస్తారు. Insertions, deletions సమయంలో tree దాదాపు balanced గా ఉండేలా చూడటానికి ఈ color bits వాడతారు. + +Tree లో ప్రతి node కి రెండు colors లో ఒకటి వేసి balance ని కాపాడతారు — కొన్ని properties కి సరిపోయేలా. +ఆ properties అన్నీ కలిసి worst case లో tree ఎంత unbalanced అవ్వొచ్చో పరిమితం చేస్తాయి. Tree మారినప్పుడు, +coloring properties మళ్ళీ రావడానికి కొత్త tree ని మళ్ళీ సర్దుతారు, మళ్ళీ రంగులు వేస్తారు. ఈ సర్దడం, మళ్ళీ +రంగులు వేయడం ఫాస్ట్ గా జరిగేలా properties డిజైన్ చేశారు. + +Tree balancing perfect కాదు, కానీ `O(log n)` టైమ్ లో search guarantee చేయడానికి సరిపోతుంది — ఇక్కడ `n` +అంటే tree లో మొత్తం elements సంఖ్య. Insertion, deletion operations, tree ని సర్దడం, మళ్ళీ రంగులు వేయడం +కూడా `O(log n)` టైమ్ లోనే జరుగుతాయి. + +Red–black tree example: + +![red-black tree](https://upload.wikimedia.org/wikipedia/commons/6/66/Red-black_tree_example.svg) + +## Properties + +Binary search tree కి ఉండే conditions తో పాటు, red–black tree ఇవి కూడా పాటించాలి: + +- ప్రతి node ఎరుపు గానీ నలుపు గానీ ఉండాలి. +- Root నలుపు. ఈ rule ని కొన్నిసార్లు వదిలేస్తారు. Root ని ఎప్పుడైనా ఎరుపు నుంచి నలుపుకి మార్చొచ్చు +(కానీ నలుపు నుంచి ఎరుపుకి ఎప్పుడూ కాదు) కాబట్టి, ఈ rule వల్ల analysis మీద పెద్ద ఎఫెక్ట్ ఉండదు. +- అన్ని leaves (NIL) నలుపు. +- ఒక node ఎరుపు అయితే, దాని ఇద్దరు children నలుపు. +- ఒక node నుంచి దాని కింద ఉన్న ఏ NIL node కి వెళ్ళే ప్రతి path లోనూ ఒకే సంఖ్యలో నలుపు nodes ఉంటాయి. + +కొన్ని definitions: root నుంచి ఒక node వరకు ఉన్న నలుపు nodes సంఖ్యని ఆ node యొక్క **black depth** అంటారు; +root నుంచి leaves వరకు అన్ని paths లో ఉండే అదే నలుపు nodes సంఖ్యని red–black tree యొక్క **black-height** అంటారు. + +ఈ conditions red–black trees కి ఒక కీలకమైన property ని తీసుకొస్తాయి: _root నుంచి అతి దూరంగా ఉన్న leaf కి +path, root నుంచి అతి దగ్గరగా ఉన్న leaf కి path కంటే రెట్టింపు కంటే ఎక్కువ పొడవు ఉండదు_. దాంతో tree దాదాపు +height-balanced గా ఉంటుంది. Values insert చేయడం, delete చేయడం, కనుక్కోవడం లాంటి operations కి worst-case +లో tree ఎత్తుకి proportional టైమ్ పడుతుంది కాబట్టి — ఎత్తు మీద ఉన్న ఈ theoretical upper bound వల్ల, +మామూలు binary search trees లాగా కాకుండా red–black trees worst case లో కూడా ఫాస్ట్ గా ఉంటాయి. + +## Insertion సమయంలో Balancing + +### Uncle ఎరుపు (RED) అయితే +![Red Black Tree Balancing](https://www.geeksforgeeks.org/wp-content/uploads/redBlackCase2.png) + +### Uncle నలుపు (BLACK) అయితే + +- Left Left Case (`p` అనేది `g` కి left child, `x` అనేది `p` కి left child) +- Left Right Case (`p` అనేది `g` కి left child, `x` అనేది `p` కి right child) +- Right Right Case (`p` అనేది `g` కి right child, `x` అనేది `p` కి right child) +- Right Left Case (`p` అనేది `g` కి right child, `x` అనేది `p` కి left child) + +(ఇక్కడ `x` అంటే కొత్తగా కలిపిన node, `p` అంటే దాని parent, `g` అంటే grandparent, uncle అంటే `p` పక్కన ఉన్న sibling.) + +#### Left Left Case (g, p, x చూడండి) + +![Red Black Tree Balancing](https://www.geeksforgeeks.org/wp-content/uploads/redBlackCase3a1.png) + +#### Left Right Case (g, p, x చూడండి) + +![Red Black Tree Balancing](https://www.geeksforgeeks.org/wp-content/uploads/redBlackCase3b.png) + +#### Right Right Case (g, p, x చూడండి) + +![Red Black Tree Balancing](https://www.geeksforgeeks.org/wp-content/uploads/redBlackCase3c.png) + +#### Right Left Case (g, p, x చూడండి) + +![Red Black Tree Balancing](https://www.geeksforgeeks.org/wp-content/uploads/redBlackCase3d.png) + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Red%E2%80%93black_tree) +- [Tushar Roy - Red Black Tree Insertion (YouTube)](https://www.youtube.com/watch?v=UaLIHuR1t8Q&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&index=63) +- [Tushar Roy - Red Black Tree Deletion (YouTube)](https://www.youtube.com/watch?v=CTvfzU_uNKE&t=0s&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&index=64) +- [GeeksForGeeks లో Red Black Tree Insertion](https://www.geeksforgeeks.org/red-black-tree-set-2-insert/) +- [Red Black Tree Interactive Visualisations](https://www.cs.usfca.edu/~galles/visualization/RedBlack.html) diff --git a/src/data-structures/tree/segment-tree/README.md b/src/data-structures/tree/segment-tree/README.md index 7c332b0262..b80c126f9d 100644 --- a/src/data-structures/tree/segment-tree/README.md +++ b/src/data-structures/tree/segment-tree/README.md @@ -1,7 +1,8 @@ # Segment Tree _Read this in other languages:_ -[_Português_](README.pt-BR.md) +[_Português_](README.pt-BR.md), +[_తెలుగు_](README.tel-IN.md) In computer science, a **segment tree** also known as a statistic tree is a tree data structure used for storing information about intervals, diff --git a/src/data-structures/tree/segment-tree/README.tel-IN.md b/src/data-structures/tree/segment-tree/README.tel-IN.md new file mode 100644 index 0000000000..7f93ffb21b --- /dev/null +++ b/src/data-structures/tree/segment-tree/README.tel-IN.md @@ -0,0 +1,41 @@ +# Segment Tree + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_Português_](README.pt-BR.md) + +Computer science లో **segment tree** (దీన్నే statistic tree అని కూడా అంటారు) అనేది intervals లేదా +segments గురించి సమాచారం store చేయడానికి వాడే tree data structure. Store చేసిన segments లో ఏవి ఒక +point ని కలిగి ఉన్నాయో query చేయడానికి ఇది ఉపయోగపడుతుంది. సూత్రప్రాయంగా ఇది static structure; అంటే, +ఒకసారి కట్టాక దీన్ని మార్చలేం. దీనిలాంటిదే ఇంకో data structure interval tree. + +Segment tree ఒక binary tree. Tree root మొత్తం array ని సూచిస్తుంది. Root యొక్క ఇద్దరు children array +మొదటి సగం, రెండో సగం ని సూచిస్తారు. అలాగే, ప్రతి node children ఆ node కి సంబంధించిన array యొక్క రెండు +సగాలని సూచిస్తారు. + +Tree ని కింద నుంచి పైకి (bottom up) కడతాం — ప్రతి node value దాని children values యొక్క "minimum" +(లేదా ఇంకేదైనా function). దీనికి `O(n log n)` టైమ్ పడుతుంది. చేసే operations సంఖ్య tree ఎత్తు, అది +`O(log n)`. Range queries చేయడానికి, ప్రతి node query ని రెండు భాగాలుగా విడగొడుతుంది — ఒక్కో child కి +ఒక sub-query. ఒక query ఒక node యొక్క subarray మొత్తాన్ని కవర్ చేస్తే, ఆ node దగ్గర ముందే లెక్కపెట్టిన +value వాడొచ్చు. ఈ optimisation తో, కేవలం `O(log n)` minimum operations మాత్రమే జరుగుతాయి అని prove చేయొచ్చు. + +![Min Segment Tree](https://www.geeksforgeeks.org/wp-content/uploads/RangeMinimumQuery.png) + +![Sum Segment Tree](https://www.geeksforgeeks.org/wp-content/uploads/segment-tree1.png) + +## ఎక్కడ వాడతారు + +Segment tree అనేది కొన్ని array operations ని — ముఖ్యంగా range queries ఉన్నవాటిని — ఫాస్ట్ గా చేయడానికి +డిజైన్ చేసిన data structure. + +Computational geometry, geographic information systems రంగాల్లో segment tree ని వాడతారు. + +ఇప్పటి Segment Tree implementation లో ఏ binary (రెండు input params ఉన్న) function నైనా ఇవ్వొచ్చు, +కాబట్టి చాలా రకాల functions కి range query చేయొచ్చు. Tests లో SegmentTree మీద `min`, `max`, `sum` +range queries చేసే examples చూడొచ్చు. + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Segment_tree) +- [YouTube](https://www.youtube.com/watch?v=ZBHKZF5w4YU&index=65&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) +- [GeeksForGeeks](https://www.geeksforgeeks.org/segment-tree-set-1-sum-of-given-range/) diff --git a/src/data-structures/trie/README.ko-KO.md b/src/data-structures/trie/README.ko-KO.md index e57142ece4..d6e0aff65e 100644 --- a/src/data-structures/trie/README.ko-KO.md +++ b/src/data-structures/trie/README.ko-KO.md @@ -5,7 +5,8 @@ _Read this in other languages:_ [_Русский_](README.ru-RU.md), [_Português_](README.pt-BR.md), [_Українська_](README.uk-UA.md), -[_한국어_](README.ko-KO.md) +[_한국어_](README.ko-KO.md), +[_తెలుగు_](README.tel-IN.md) 컴퓨터 과학에서 **트라이**는 디지털 트리라고도 불리며 때로는 기수 트리 또는 접두사 트리(접두사로 검색할 수 있기 때문에)라고도 불리며 일종의 검색 트리입니다. 키가 보통 문자열인 동적 집합 또는 연관 배열을 저장하는 데 사용되는 순서가 지정된 트리 데이터 구조입니다. 이진 검색 트리와 달리 트리의 어떤 노드도 해당 노드와 연결된 키를 저장하지 않으며 대신 트리의 위치가 해당 노드와 연결된 키를 정의합니다. 노드의 모든 하위 항목은 해당 노드와 연결된 문자열의 공통 접두사를 가지며 루트는 빈 문자열과 연결됩니다. 값은 모든 노드와 반드시 연결되지는 않습니다. 오히려 값은 나뭇잎과 관심 있는 키에 해당하는 일부 내부 노드에만 연결되는 경향이 있습니다. 접두사 트리의 공간에 최적화된 표현은 콤팩트 접두사 트리를 참조하십시오. diff --git a/src/data-structures/trie/README.md b/src/data-structures/trie/README.md index b3bba5de1e..ff1db01ca3 100644 --- a/src/data-structures/trie/README.md +++ b/src/data-structures/trie/README.md @@ -5,7 +5,8 @@ _Read this in other languages:_ [_Русский_](README.ru-RU.md), [_Português_](README.pt-BR.md), [_Українська_](README.uk-UA.md), -[_한국어_](README.ko-KO.md) +[_한국어_](README.ko-KO.md), +[_తెలుగు_](README.tel-IN.md) In computer science, a **trie**, also called digital tree and sometimes radix tree or prefix tree (as they can be searched by prefixes), diff --git a/src/data-structures/trie/README.tel-IN.md b/src/data-structures/trie/README.tel-IN.md new file mode 100644 index 0000000000..45070bdd3a --- /dev/null +++ b/src/data-structures/trie/README.tel-IN.md @@ -0,0 +1,28 @@ +# Trie + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md), +[_简体中文_](README.zh-CN.md), +[_Русский_](README.ru-RU.md), +[_Português_](README.pt-BR.md), +[_Українська_](README.uk-UA.md), +[_한국어_](README.ko-KO.md) + +Computer science లో **trie** (దీన్నే digital tree అని, కొన్నిసార్లు radix tree లేదా prefix tree అని కూడా +అంటారు — ఎందుకంటే prefixes తో వీటిలో search చేయొచ్చు) అనేది ఒక రకమైన search tree — keys మామూలుగా +strings గా ఉండే dynamic set ని గానీ associative array ని గానీ store చేయడానికి వాడే ordered tree data +structure. Binary search tree లాగా కాకుండా, tree లో ఏ node కూడా తనకి సంబంధించిన key ని store చేయదు; +బదులుగా, tree లో దాని position నే దానికి సంబంధించిన key ఏంటో నిర్ణయిస్తుంది. ఒక node కింద ఉన్న +descendants అందరికీ, ఆ node కి సంబంధించిన string common prefix గా ఉంటుంది, ఇంకా root కి empty string +సంబంధించి ఉంటుంది. ప్రతి node కి value ఉండాల్సిన అవసరం లేదు. మామూలుగా values leaves కి, ఇంకా మనకి +కావాల్సిన keys కి సరిపోయే కొన్ని inner nodes కి మాత్రమే ఉంటాయి. Space తక్కువ వాడే prefix tree కోసం +compact prefix tree చూడండి. + +![Trie](./images/trie.jpg) + +*[okso.app](https://okso.app) తో తయారుచేశారు* + +## References + +- [Wikipedia](https://en.wikipedia.org/wiki/Trie) +- [YouTube](https://www.youtube.com/watch?v=zIjfhVPRZCg&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&index=7&t=0s) diff --git a/src/playground/README.md b/src/playground/README.md index 7307a6b58d..0e3ff85490 100644 --- a/src/playground/README.md +++ b/src/playground/README.md @@ -1,5 +1,8 @@ # Playground +_Read this in other languages:_ +[_తెలుగు_](README.tel-IN.md) + You may use `playground.js` file to play with data structures and algorithms. The code from `playground.js` may be tested in `./__test__/playground.test.js` file. diff --git a/src/playground/README.tel-IN.md b/src/playground/README.tel-IN.md new file mode 100644 index 0000000000..9f92372979 --- /dev/null +++ b/src/playground/README.tel-IN.md @@ -0,0 +1,13 @@ +# Playground + +_వేరే భాషల్లో చదవాలంటే:_ +[_English_](README.md) + +Data structures, algorithms తో ఆడుకోవడానికి `playground.js` file వాడొచ్చు. `playground.js` లో +రాసిన code ని `./__test__/playground.test.js` file లో test చేయొచ్చు. + +Tests రన్ చేయడానికి ఇది రన్ చేస్తే చాలు: + +``` +npm test -- -t 'playground' +``` From c36322a2889ea51d98e811ee96bedc889a7697ff Mon Sep 17 00:00:00 2001 From: Yashwanth Date: Sun, 1 Nov 2026 22:45:41 -0800 Subject: [PATCH 2/2] Rename Telugu READMEs to use te-IN locale code The contributing guide asks for README.xx-XX.md, where xx is the two-letter language code. Telugu's two-letter code is te, so rename all 112 README.tel-IN.md files to README.te-IN.md and update the links in the English and translated READMEs. --- README.ar-AR.md | 2 +- README.de-DE.md | 2 +- README.es-ES.md | 2 +- README.fr-FR.md | 2 +- README.he-IL.md | 2 +- README.id-ID.md | 2 +- README.it-IT.md | 2 +- README.ja-JP.md | 2 +- README.ko-KR.md | 2 +- README.md | 2 +- README.pl-PL.md | 2 +- README.pt-BR.md | 2 +- README.ru-RU.md | 2 +- README.tel-IN.md => README.te-IN.md | 0 README.tr-TR.md | 2 +- README.uk-UA.md | 2 +- README.uz-UZ.md | 2 +- README.vi-VN.md | 2 +- README.zh-CN.md | 2 +- README.zh-TW.md | 2 +- src/algorithms/cryptography/caesar-cipher/README.md | 2 +- .../caesar-cipher/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/cryptography/hill-cipher/README.md | 2 +- .../hill-cipher/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/cryptography/polynomial-hash/README.md | 2 +- .../polynomial-hash/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/cryptography/rail-fence-cipher/README.md | 2 +- .../rail-fence-cipher/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/graph/articulation-points/README.md | 2 +- .../articulation-points/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/graph/bellman-ford/README.md | 2 +- .../graph/bellman-ford/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/graph/breadth-first-search/README.md | 2 +- .../breadth-first-search/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/graph/bridges/README.md | 2 +- .../graph/bridges/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/graph/depth-first-search/README.md | 2 +- .../depth-first-search/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/graph/detect-cycle/README.md | 2 +- .../graph/detect-cycle/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/graph/dijkstra/README.de-DE.md | 2 +- src/algorithms/graph/dijkstra/README.es-ES.md | 2 +- src/algorithms/graph/dijkstra/README.fr-FR.md | 2 +- src/algorithms/graph/dijkstra/README.he-IL.md | 2 +- src/algorithms/graph/dijkstra/README.ja-JP.md | 2 +- src/algorithms/graph/dijkstra/README.ko-KR.md | 2 +- src/algorithms/graph/dijkstra/README.md | 2 +- .../graph/dijkstra/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/graph/dijkstra/README.uk-UA.md | 2 +- src/algorithms/graph/dijkstra/README.zh-CN.md | 2 +- src/algorithms/graph/dijkstra/README.zh-TW.md | 2 +- src/algorithms/graph/eulerian-path/README.md | 2 +- .../graph/eulerian-path/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/graph/floyd-warshall/README.md | 2 +- .../graph/floyd-warshall/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/graph/hamiltonian-cycle/README.md | 2 +- .../hamiltonian-cycle/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/graph/kruskal/README.md | 2 +- .../graph/kruskal/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/graph/prim/README.md | 2 +- src/algorithms/graph/prim/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/graph/strongly-connected-components/README.md | 2 +- .../{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/graph/topological-sorting/README.md | 2 +- .../topological-sorting/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/graph/travelling-salesman/README.md | 2 +- .../travelling-salesman/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/image-processing/seam-carving/README.md | 2 +- .../seam-carving/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/linked-list/reverse-traversal/README.md | 2 +- src/algorithms/linked-list/reverse-traversal/README.pt-BR.md | 2 +- .../reverse-traversal/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/linked-list/traversal/README.md | 2 +- src/algorithms/linked-list/traversal/README.pt-BR.md | 2 +- .../linked-list/traversal/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/binary-floating-point/README.md | 2 +- .../binary-floating-point/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/bits/README.fr-FR.md | 2 +- src/algorithms/math/bits/README.md | 2 +- src/algorithms/math/bits/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/bits/README.zh-CN.md | 2 +- src/algorithms/math/complex-number/README.fr-FR.md | 2 +- src/algorithms/math/complex-number/README.md | 2 +- .../math/complex-number/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/euclidean-algorithm/README.fr-FR.md | 2 +- src/algorithms/math/euclidean-algorithm/README.md | 2 +- .../euclidean-algorithm/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/euclidean-distance/README.md | 2 +- .../euclidean-distance/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/factorial/README.fr-FR.md | 2 +- src/algorithms/math/factorial/README.md | 2 +- .../math/factorial/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/factorial/README.tr-TR.md | 2 +- src/algorithms/math/factorial/README.uk-UA.md | 2 +- src/algorithms/math/fast-powering/README.fr-FR.md | 2 +- src/algorithms/math/fast-powering/README.md | 2 +- .../math/fast-powering/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/fibonacci/README.fr-FR.md | 2 +- src/algorithms/math/fibonacci/README.md | 2 +- .../math/fibonacci/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/fibonacci/README.zh-CN.md | 2 +- src/algorithms/math/fourier-transform/README.fr-FR.md | 2 +- src/algorithms/math/fourier-transform/README.md | 2 +- .../fourier-transform/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/horner-method/README.md | 2 +- .../math/horner-method/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/integer-partition/README.md | 2 +- .../integer-partition/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/is-power-of-two/README.md | 2 +- .../math/is-power-of-two/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/least-common-multiple/README.md | 2 +- .../least-common-multiple/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/liu-hui/README.md | 2 +- .../math/liu-hui/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/matrix/README.md | 2 +- .../math/matrix/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/pascal-triangle/README.md | 2 +- .../math/pascal-triangle/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/primality-test/README.md | 2 +- .../math/primality-test/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/prime-factors/README.md | 2 +- .../math/prime-factors/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/prime-factors/README.zh-CN.md | 2 +- src/algorithms/math/radian/README.md | 2 +- .../math/radian/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/sieve-of-eratosthenes/README.md | 2 +- .../sieve-of-eratosthenes/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/math/square-root/README.md | 2 +- .../math/square-root/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/ml/k-means/README.md | 2 +- src/algorithms/ml/k-means/README.pt-BR.md | 2 +- src/algorithms/ml/k-means/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/ml/knn/README.md | 2 +- src/algorithms/ml/knn/README.pt-BR.md | 2 +- src/algorithms/ml/knn/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/search/binary-search/README.es-ES.md | 2 +- src/algorithms/search/binary-search/README.md | 2 +- src/algorithms/search/binary-search/README.pt-BR.md | 2 +- .../search/binary-search/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/search/interpolation-search/README.md | 2 +- .../interpolation-search/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/search/jump-search/README.md | 2 +- .../search/jump-search/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/search/linear-search/README.md | 2 +- src/algorithms/search/linear-search/README.pt-BR.md | 2 +- .../search/linear-search/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sets/cartesian-product/README.md | 2 +- .../cartesian-product/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sets/combination-sum/README.md | 2 +- .../sets/combination-sum/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sets/combinations/README.md | 2 +- .../sets/combinations/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sets/fisher-yates/README.md | 2 +- .../sets/fisher-yates/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sets/knapsack-problem/README.md | 2 +- .../sets/knapsack-problem/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sets/longest-common-subsequence/README.md | 2 +- .../{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sets/longest-increasing-subsequence/README.md | 2 +- .../{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sets/maximum-subarray/README.md | 2 +- .../sets/maximum-subarray/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sets/permutations/README.md | 2 +- .../sets/permutations/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sets/power-set/README.md | 2 +- .../sets/power-set/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sets/shortest-common-supersequence/README.md | 2 +- .../{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sorting/bubble-sort/README.md | 2 +- src/algorithms/sorting/bubble-sort/README.pt-BR.md | 2 +- .../sorting/bubble-sort/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sorting/bucket-sort/README.md | 2 +- .../sorting/bucket-sort/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sorting/counting-sort/README.md | 2 +- src/algorithms/sorting/counting-sort/README.pt-br.md | 2 +- .../sorting/counting-sort/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sorting/heap-sort/README.md | 2 +- src/algorithms/sorting/heap-sort/README.pt-BR.md | 2 +- .../sorting/heap-sort/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sorting/insertion-sort/README.md | 2 +- src/algorithms/sorting/insertion-sort/README.pt-BR.md | 2 +- .../insertion-sort/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sorting/merge-sort/README.md | 2 +- src/algorithms/sorting/merge-sort/README.pt-BR.md | 2 +- .../sorting/merge-sort/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sorting/quick-sort/README.md | 2 +- src/algorithms/sorting/quick-sort/README.pt-BR.md | 2 +- .../sorting/quick-sort/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sorting/radix-sort/README.md | 2 +- src/algorithms/sorting/radix-sort/README.pt-BR.md | 2 +- .../sorting/radix-sort/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sorting/selection-sort/README.md | 2 +- src/algorithms/sorting/selection-sort/README.pt-BR.md | 2 +- .../selection-sort/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/sorting/shell-sort/README.md | 2 +- src/algorithms/sorting/shell-sort/README.pt-BR.md | 2 +- .../sorting/shell-sort/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/stack/valid-parentheses/README.md | 2 +- .../valid-parentheses/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/statistics/weighted-random/README.md | 2 +- .../weighted-random/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/string/hamming-distance/README.md | 2 +- .../hamming-distance/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/string/knuth-morris-pratt/README.md | 2 +- .../knuth-morris-pratt/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/string/levenshtein-distance/README.md | 2 +- .../levenshtein-distance/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/string/longest-common-substring/README.md | 2 +- .../{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/string/palindrome/README.md | 2 +- .../string/palindrome/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/string/rabin-karp/README.md | 2 +- .../string/rabin-karp/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/string/regular-expression-matching/README.md | 2 +- .../{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/string/z-algorithm/README.md | 2 +- .../string/z-algorithm/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/tree/breadth-first-search/README.md | 2 +- .../breadth-first-search/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/tree/depth-first-search/README.md | 2 +- .../depth-first-search/{README.tel-IN.md => README.te-IN.md} | 0 .../uncategorized/best-time-to-buy-sell-stocks/README.md | 2 +- .../{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/uncategorized/hanoi-tower/README.md | 2 +- .../hanoi-tower/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/uncategorized/jump-game/README.md | 2 +- .../jump-game/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/uncategorized/knight-tour/README.md | 2 +- .../knight-tour/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/uncategorized/n-queens/README.md | 2 +- .../n-queens/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/uncategorized/rain-terraces/README.md | 2 +- .../rain-terraces/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/uncategorized/recursive-staircase/README.md | 2 +- .../recursive-staircase/{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/uncategorized/square-matrix-rotation/README.md | 2 +- .../{README.tel-IN.md => README.te-IN.md} | 0 src/algorithms/uncategorized/unique-paths/README.md | 2 +- .../unique-paths/{README.tel-IN.md => README.te-IN.md} | 0 src/data-structures/bloom-filter/README.md | 2 +- .../bloom-filter/{README.tel-IN.md => README.te-IN.md} | 0 src/data-structures/deque/README.md | 2 +- src/data-structures/deque/{README.tel-IN.md => README.te-IN.md} | 0 src/data-structures/disjoint-set/README.md | 2 +- .../disjoint-set/{README.tel-IN.md => README.te-IN.md} | 0 src/data-structures/doubly-linked-list/README.es-ES.md | 2 +- src/data-structures/doubly-linked-list/README.ko-KR.md | 2 +- src/data-structures/doubly-linked-list/README.md | 2 +- .../doubly-linked-list/{README.tel-IN.md => README.te-IN.md} | 0 src/data-structures/graph/README.md | 2 +- src/data-structures/graph/{README.tel-IN.md => README.te-IN.md} | 0 src/data-structures/hash-table/README.ko-KR.md | 2 +- src/data-structures/hash-table/README.md | 2 +- .../hash-table/{README.tel-IN.md => README.te-IN.md} | 0 src/data-structures/heap/README.md | 2 +- src/data-structures/heap/{README.tel-IN.md => README.te-IN.md} | 0 src/data-structures/linked-list/README.es-ES.md | 2 +- src/data-structures/linked-list/README.ko-KR.md | 2 +- src/data-structures/linked-list/README.md | 2 +- .../linked-list/{README.tel-IN.md => README.te-IN.md} | 0 src/data-structures/linked-list/README.tr-TR.md | 2 +- src/data-structures/linked-list/README.vi-VN.md | 2 +- src/data-structures/lru-cache/README.md | 2 +- .../lru-cache/{README.tel-IN.md => README.te-IN.md} | 0 src/data-structures/priority-queue/README.md | 2 +- .../priority-queue/{README.tel-IN.md => README.te-IN.md} | 0 src/data-structures/queue/README.ko-KR.md | 2 +- src/data-structures/queue/README.md | 2 +- src/data-structures/queue/{README.tel-IN.md => README.te-IN.md} | 0 src/data-structures/queue/README.vi-VN.md | 2 +- src/data-structures/stack/README.ko-KR.md | 2 +- src/data-structures/stack/README.md | 2 +- src/data-structures/stack/{README.tel-IN.md => README.te-IN.md} | 0 src/data-structures/stack/README.vi-VN.md | 2 +- src/data-structures/tree/README.md | 2 +- src/data-structures/tree/{README.tel-IN.md => README.te-IN.md} | 0 src/data-structures/tree/avl-tree/README.md | 2 +- .../tree/avl-tree/{README.tel-IN.md => README.te-IN.md} | 0 src/data-structures/tree/binary-search-tree/README.md | 2 +- .../binary-search-tree/{README.tel-IN.md => README.te-IN.md} | 0 src/data-structures/tree/fenwick-tree/README.md | 2 +- .../tree/fenwick-tree/{README.tel-IN.md => README.te-IN.md} | 0 src/data-structures/tree/red-black-tree/README.md | 2 +- .../tree/red-black-tree/{README.tel-IN.md => README.te-IN.md} | 0 src/data-structures/tree/segment-tree/README.md | 2 +- .../tree/segment-tree/{README.tel-IN.md => README.te-IN.md} | 0 src/data-structures/trie/README.ko-KO.md | 2 +- src/data-structures/trie/README.md | 2 +- src/data-structures/trie/{README.tel-IN.md => README.te-IN.md} | 0 src/playground/README.md | 2 +- src/playground/{README.tel-IN.md => README.te-IN.md} | 0 291 files changed, 179 insertions(+), 179 deletions(-) rename README.tel-IN.md => README.te-IN.md (100%) rename src/algorithms/cryptography/caesar-cipher/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/cryptography/hill-cipher/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/cryptography/polynomial-hash/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/cryptography/rail-fence-cipher/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/graph/articulation-points/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/graph/bellman-ford/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/graph/breadth-first-search/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/graph/bridges/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/graph/depth-first-search/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/graph/detect-cycle/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/graph/dijkstra/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/graph/eulerian-path/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/graph/floyd-warshall/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/graph/hamiltonian-cycle/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/graph/kruskal/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/graph/prim/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/graph/strongly-connected-components/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/graph/topological-sorting/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/graph/travelling-salesman/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/image-processing/seam-carving/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/linked-list/reverse-traversal/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/linked-list/traversal/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/binary-floating-point/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/bits/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/complex-number/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/euclidean-algorithm/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/euclidean-distance/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/factorial/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/fast-powering/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/fibonacci/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/fourier-transform/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/horner-method/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/integer-partition/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/is-power-of-two/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/least-common-multiple/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/liu-hui/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/matrix/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/pascal-triangle/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/primality-test/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/prime-factors/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/radian/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/sieve-of-eratosthenes/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/math/square-root/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/ml/k-means/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/ml/knn/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/search/binary-search/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/search/interpolation-search/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/search/jump-search/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/search/linear-search/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sets/cartesian-product/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sets/combination-sum/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sets/combinations/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sets/fisher-yates/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sets/knapsack-problem/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sets/longest-common-subsequence/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sets/longest-increasing-subsequence/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sets/maximum-subarray/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sets/permutations/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sets/power-set/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sets/shortest-common-supersequence/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sorting/bubble-sort/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sorting/bucket-sort/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sorting/counting-sort/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sorting/heap-sort/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sorting/insertion-sort/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sorting/merge-sort/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sorting/quick-sort/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sorting/radix-sort/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sorting/selection-sort/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/sorting/shell-sort/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/stack/valid-parentheses/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/statistics/weighted-random/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/string/hamming-distance/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/string/knuth-morris-pratt/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/string/levenshtein-distance/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/string/longest-common-substring/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/string/palindrome/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/string/rabin-karp/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/string/regular-expression-matching/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/string/z-algorithm/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/tree/breadth-first-search/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/tree/depth-first-search/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/uncategorized/best-time-to-buy-sell-stocks/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/uncategorized/hanoi-tower/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/uncategorized/jump-game/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/uncategorized/knight-tour/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/uncategorized/n-queens/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/uncategorized/rain-terraces/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/uncategorized/recursive-staircase/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/uncategorized/square-matrix-rotation/{README.tel-IN.md => README.te-IN.md} (100%) rename src/algorithms/uncategorized/unique-paths/{README.tel-IN.md => README.te-IN.md} (100%) rename src/data-structures/bloom-filter/{README.tel-IN.md => README.te-IN.md} (100%) rename src/data-structures/deque/{README.tel-IN.md => README.te-IN.md} (100%) rename src/data-structures/disjoint-set/{README.tel-IN.md => README.te-IN.md} (100%) rename src/data-structures/doubly-linked-list/{README.tel-IN.md => README.te-IN.md} (100%) rename src/data-structures/graph/{README.tel-IN.md => README.te-IN.md} (100%) rename src/data-structures/hash-table/{README.tel-IN.md => README.te-IN.md} (100%) rename src/data-structures/heap/{README.tel-IN.md => README.te-IN.md} (100%) rename src/data-structures/linked-list/{README.tel-IN.md => README.te-IN.md} (100%) rename src/data-structures/lru-cache/{README.tel-IN.md => README.te-IN.md} (100%) rename src/data-structures/priority-queue/{README.tel-IN.md => README.te-IN.md} (100%) rename src/data-structures/queue/{README.tel-IN.md => README.te-IN.md} (100%) rename src/data-structures/stack/{README.tel-IN.md => README.te-IN.md} (100%) rename src/data-structures/tree/{README.tel-IN.md => README.te-IN.md} (100%) rename src/data-structures/tree/avl-tree/{README.tel-IN.md => README.te-IN.md} (100%) rename src/data-structures/tree/binary-search-tree/{README.tel-IN.md => README.te-IN.md} (100%) rename src/data-structures/tree/fenwick-tree/{README.tel-IN.md => README.te-IN.md} (100%) rename src/data-structures/tree/red-black-tree/{README.tel-IN.md => README.te-IN.md} (100%) rename src/data-structures/tree/segment-tree/{README.tel-IN.md => README.te-IN.md} (100%) rename src/data-structures/trie/{README.tel-IN.md => README.te-IN.md} (100%) rename src/playground/{README.tel-IN.md => README.te-IN.md} (100%) diff --git a/README.ar-AR.md b/README.ar-AR.md index bca74f896c..f413ae891d 100644 --- a/README.ar-AR.md +++ b/README.ar-AR.md @@ -26,7 +26,7 @@ _اقرأ هذا في لغات أخرى:_ [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## هياكل البيانات diff --git a/README.de-DE.md b/README.de-DE.md index f342f66a21..f2b38796e0 100644 --- a/README.de-DE.md +++ b/README.de-DE.md @@ -27,7 +27,7 @@ _Lies dies in anderen Sprachen:_ [_Arabic_](README.ar-AR.md), [_Uzbek_](README.uz-UZ.md) [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## Datenstrukturen diff --git a/README.es-ES.md b/README.es-ES.md index 7c240a7773..2e899e6af0 100644 --- a/README.es-ES.md +++ b/README.es-ES.md @@ -28,7 +28,7 @@ _Léelo en otros idiomas:_ [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## Estructuras de Datos diff --git a/README.fr-FR.md b/README.fr-FR.md index dbd2c61547..47adfa921e 100644 --- a/README.fr-FR.md +++ b/README.fr-FR.md @@ -29,7 +29,7 @@ _Lisez ceci dans d'autres langues:_ [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## Data Structures diff --git a/README.he-IL.md b/README.he-IL.md index 0ba7951365..dd9c5cea31 100644 --- a/README.he-IL.md +++ b/README.he-IL.md @@ -26,7 +26,7 @@ _קרא זאת בשפות אחרות:_ [_Tiếng Việt_](README.vi-VN.md), [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## מבני נתונים diff --git a/README.id-ID.md b/README.id-ID.md index ddf0e64e68..cfeac9803e 100644 --- a/README.id-ID.md +++ b/README.id-ID.md @@ -26,7 +26,7 @@ _Baca ini dalam bahasa yang lain:_ [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## Struktur Data diff --git a/README.it-IT.md b/README.it-IT.md index 8505ff19d0..9edebe6d54 100644 --- a/README.it-IT.md +++ b/README.it-IT.md @@ -25,7 +25,7 @@ _Leggilo in altre lingue:_ [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## Strutture Dati diff --git a/README.ja-JP.md b/README.ja-JP.md index a5c7dfe558..7dcefe87f4 100644 --- a/README.ja-JP.md +++ b/README.ja-JP.md @@ -28,7 +28,7 @@ _Read this in other languages:_ [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## データ構造 diff --git a/README.ko-KR.md b/README.ko-KR.md index 2aefb29de8..3990395e19 100644 --- a/README.ko-KR.md +++ b/README.ko-KR.md @@ -27,7 +27,7 @@ _Read this in other languages:_ [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## 자료 구조 diff --git a/README.md b/README.md index ed8bcf4873..cfa6eab74b 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ _Read this in other languages:_ [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md), [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## Data Structures diff --git a/README.pl-PL.md b/README.pl-PL.md index b7542a3425..fdb7e0a8e9 100644 --- a/README.pl-PL.md +++ b/README.pl-PL.md @@ -29,7 +29,7 @@ _Read this in other languages:_ [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## Struktury Danych diff --git a/README.pt-BR.md b/README.pt-BR.md index 047410550e..fd9fafcb60 100644 --- a/README.pt-BR.md +++ b/README.pt-BR.md @@ -29,7 +29,7 @@ _Leia isto em outros idiomas:_ [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## Estrutura de Dados diff --git a/README.ru-RU.md b/README.ru-RU.md index f48accc6e0..21fe38c4c0 100644 --- a/README.ru-RU.md +++ b/README.ru-RU.md @@ -26,7 +26,7 @@ _Читать на других языках:_ [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## Структуры данных diff --git a/README.tel-IN.md b/README.te-IN.md similarity index 100% rename from README.tel-IN.md rename to README.te-IN.md diff --git a/README.tr-TR.md b/README.tr-TR.md index 4f0e7be0f9..7110a8af2d 100644 --- a/README.tr-TR.md +++ b/README.tr-TR.md @@ -26,7 +26,7 @@ _Read this in other languages:_ [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## Veri Yapıları diff --git a/README.uk-UA.md b/README.uk-UA.md index 3d6456fb3d..647586d31b 100644 --- a/README.uk-UA.md +++ b/README.uk-UA.md @@ -26,7 +26,7 @@ _Вивчення матеріалу на інших мовах:_ [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## Структури даних diff --git a/README.uz-UZ.md b/README.uz-UZ.md index 6942ada7c5..664266c793 100644 --- a/README.uz-UZ.md +++ b/README.uz-UZ.md @@ -30,7 +30,7 @@ _Read this in other languages:_ [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## Ma'lumotlar tuzilmalari diff --git a/README.vi-VN.md b/README.vi-VN.md index 811fcfe072..f4c6194b64 100644 --- a/README.vi-VN.md +++ b/README.vi-VN.md @@ -26,7 +26,7 @@ _Đọc bằng ngôn ngữ khác:_ [_Українська_](README.uk-UA.md), [_Arabic_](README.ar-AR.md) [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## Cấu Trúc Dữ Liệu diff --git a/README.zh-CN.md b/README.zh-CN.md index a81c92161e..d8e29148e1 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -26,7 +26,7 @@ _Read this in other languages:_ [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## 数据结构 diff --git a/README.zh-TW.md b/README.zh-TW.md index 0c6c417756..1cb5913319 100644 --- a/README.zh-TW.md +++ b/README.zh-TW.md @@ -25,7 +25,7 @@ _Read this in other languages:_ [_Deutsch_](README.de-DE.md), [_Uzbek_](README.uz-UZ.md) [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## 資料結構 diff --git a/src/algorithms/cryptography/caesar-cipher/README.md b/src/algorithms/cryptography/caesar-cipher/README.md index dd69cb3c1a..7809081bf2 100644 --- a/src/algorithms/cryptography/caesar-cipher/README.md +++ b/src/algorithms/cryptography/caesar-cipher/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [_Русский_](README.ru-RU.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In cryptography, a **Caesar cipher**, also known as **Caesar's cipher**, the **shift cipher**, **Caesar's code** or **Caesar shift**, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of `3`, `D` would be replaced by `A`, `E` would become `B`, and so on. The method is named after Julius Caesar, who used it in his private correspondence. diff --git a/src/algorithms/cryptography/caesar-cipher/README.tel-IN.md b/src/algorithms/cryptography/caesar-cipher/README.te-IN.md similarity index 100% rename from src/algorithms/cryptography/caesar-cipher/README.tel-IN.md rename to src/algorithms/cryptography/caesar-cipher/README.te-IN.md diff --git a/src/algorithms/cryptography/hill-cipher/README.md b/src/algorithms/cryptography/hill-cipher/README.md index ba2cdadce2..91fa9b7bab 100644 --- a/src/algorithms/cryptography/hill-cipher/README.md +++ b/src/algorithms/cryptography/hill-cipher/README.md @@ -1,7 +1,7 @@ # Hill Cipher _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The **Hill cipher** is a [polygraphic substitution](https://en.wikipedia.org/wiki/Polygraphic_substitution) cipher based on linear algebra. diff --git a/src/algorithms/cryptography/hill-cipher/README.tel-IN.md b/src/algorithms/cryptography/hill-cipher/README.te-IN.md similarity index 100% rename from src/algorithms/cryptography/hill-cipher/README.tel-IN.md rename to src/algorithms/cryptography/hill-cipher/README.te-IN.md diff --git a/src/algorithms/cryptography/polynomial-hash/README.md b/src/algorithms/cryptography/polynomial-hash/README.md index 21cd01a776..8e93d7b424 100644 --- a/src/algorithms/cryptography/polynomial-hash/README.md +++ b/src/algorithms/cryptography/polynomial-hash/README.md @@ -1,7 +1,7 @@ # Polynomial Rolling Hash _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## Hash Function diff --git a/src/algorithms/cryptography/polynomial-hash/README.tel-IN.md b/src/algorithms/cryptography/polynomial-hash/README.te-IN.md similarity index 100% rename from src/algorithms/cryptography/polynomial-hash/README.tel-IN.md rename to src/algorithms/cryptography/polynomial-hash/README.te-IN.md diff --git a/src/algorithms/cryptography/rail-fence-cipher/README.md b/src/algorithms/cryptography/rail-fence-cipher/README.md index f73aad0d1d..afae9ddbda 100644 --- a/src/algorithms/cryptography/rail-fence-cipher/README.md +++ b/src/algorithms/cryptography/rail-fence-cipher/README.md @@ -1,7 +1,7 @@ # Rail Fence Cipher _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The **rail fence cipher** (also called a **zigzag cipher**) is a [transposition cipher](https://en.wikipedia.org/wiki/Transposition_cipher) in which the message is split across a set of rails on a fence for encoding. The fence is populated with the message's characters, starting at the top left and adding a character on each position, traversing them diagonally to the bottom. Upon reaching the last rail, the direction should then turn diagonal and upwards up to the very first rail in a zig-zag motion. Rinse and repeat until the message is fully disposed across the fence. The encoded message is the result of concatenating the text in each rail, from top to bottom. diff --git a/src/algorithms/cryptography/rail-fence-cipher/README.tel-IN.md b/src/algorithms/cryptography/rail-fence-cipher/README.te-IN.md similarity index 100% rename from src/algorithms/cryptography/rail-fence-cipher/README.tel-IN.md rename to src/algorithms/cryptography/rail-fence-cipher/README.te-IN.md diff --git a/src/algorithms/graph/articulation-points/README.md b/src/algorithms/graph/articulation-points/README.md index daa49c94ae..ad29d647ae 100644 --- a/src/algorithms/graph/articulation-points/README.md +++ b/src/algorithms/graph/articulation-points/README.md @@ -1,7 +1,7 @@ # Articulation Points (or Cut Vertices) _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) A vertex in an undirected connected graph is an articulation point (or cut vertex) if removing it (and edges through it) disconnects diff --git a/src/algorithms/graph/articulation-points/README.tel-IN.md b/src/algorithms/graph/articulation-points/README.te-IN.md similarity index 100% rename from src/algorithms/graph/articulation-points/README.tel-IN.md rename to src/algorithms/graph/articulation-points/README.te-IN.md diff --git a/src/algorithms/graph/bellman-ford/README.md b/src/algorithms/graph/bellman-ford/README.md index b9db7128f7..7e715bc2f4 100644 --- a/src/algorithms/graph/bellman-ford/README.md +++ b/src/algorithms/graph/bellman-ford/README.md @@ -1,7 +1,7 @@ # Bellman–Ford Algorithm _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The Bellman–Ford algorithm is an algorithm that computes shortest paths from a single source vertex to all of the other vertices diff --git a/src/algorithms/graph/bellman-ford/README.tel-IN.md b/src/algorithms/graph/bellman-ford/README.te-IN.md similarity index 100% rename from src/algorithms/graph/bellman-ford/README.tel-IN.md rename to src/algorithms/graph/bellman-ford/README.te-IN.md diff --git a/src/algorithms/graph/breadth-first-search/README.md b/src/algorithms/graph/breadth-first-search/README.md index d7a19b37ae..5fe3beb2cc 100644 --- a/src/algorithms/graph/breadth-first-search/README.md +++ b/src/algorithms/graph/breadth-first-search/README.md @@ -1,7 +1,7 @@ # Breadth-First Search (BFS) _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Breadth-first search (BFS) is an algorithm for traversing, searching tree, or graph data structures. It starts at diff --git a/src/algorithms/graph/breadth-first-search/README.tel-IN.md b/src/algorithms/graph/breadth-first-search/README.te-IN.md similarity index 100% rename from src/algorithms/graph/breadth-first-search/README.tel-IN.md rename to src/algorithms/graph/breadth-first-search/README.te-IN.md diff --git a/src/algorithms/graph/bridges/README.md b/src/algorithms/graph/bridges/README.md index 5d668dd1d2..daf5e70c02 100644 --- a/src/algorithms/graph/bridges/README.md +++ b/src/algorithms/graph/bridges/README.md @@ -1,7 +1,7 @@ # Bridges in Graph _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In graph theory, a **bridge**, **isthmus**, **cut-edge**, or **cut arc** is an edge of a graph whose deletion increases its number of connected components. Equivalently, diff --git a/src/algorithms/graph/bridges/README.tel-IN.md b/src/algorithms/graph/bridges/README.te-IN.md similarity index 100% rename from src/algorithms/graph/bridges/README.tel-IN.md rename to src/algorithms/graph/bridges/README.te-IN.md diff --git a/src/algorithms/graph/depth-first-search/README.md b/src/algorithms/graph/depth-first-search/README.md index 5550d77507..6dc9370e14 100644 --- a/src/algorithms/graph/depth-first-search/README.md +++ b/src/algorithms/graph/depth-first-search/README.md @@ -1,7 +1,7 @@ # Depth-First Search (DFS) _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. One starts at diff --git a/src/algorithms/graph/depth-first-search/README.tel-IN.md b/src/algorithms/graph/depth-first-search/README.te-IN.md similarity index 100% rename from src/algorithms/graph/depth-first-search/README.tel-IN.md rename to src/algorithms/graph/depth-first-search/README.te-IN.md diff --git a/src/algorithms/graph/detect-cycle/README.md b/src/algorithms/graph/detect-cycle/README.md index f748bf8788..0243acc7e0 100644 --- a/src/algorithms/graph/detect-cycle/README.md +++ b/src/algorithms/graph/detect-cycle/README.md @@ -1,7 +1,7 @@ # Detect Cycle in Graphs _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In graph theory, a **cycle** is a path of edges and vertices wherein a vertex is reachable from itself. There are several diff --git a/src/algorithms/graph/detect-cycle/README.tel-IN.md b/src/algorithms/graph/detect-cycle/README.te-IN.md similarity index 100% rename from src/algorithms/graph/detect-cycle/README.tel-IN.md rename to src/algorithms/graph/detect-cycle/README.te-IN.md diff --git a/src/algorithms/graph/dijkstra/README.de-DE.md b/src/algorithms/graph/dijkstra/README.de-DE.md index c1f76eb194..403e97496e 100644 --- a/src/algorithms/graph/dijkstra/README.de-DE.md +++ b/src/algorithms/graph/dijkstra/README.de-DE.md @@ -11,7 +11,7 @@ _Lies dies in anderen Sprachen:_ [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Der Dijkstra-Algorithmus ist ein Algorithmus zur Bestimmung der kürzesten Wege zwischen Knoten in einem Graphen, der beispielsweise Straßennetze darstellen kann. diff --git a/src/algorithms/graph/dijkstra/README.es-ES.md b/src/algorithms/graph/dijkstra/README.es-ES.md index a53fc35a02..569e92ea88 100644 --- a/src/algorithms/graph/dijkstra/README.es-ES.md +++ b/src/algorithms/graph/dijkstra/README.es-ES.md @@ -11,7 +11,7 @@ _Lee esto en otros idiomas:_ [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) El algoritmo de Dijkstra es un algoritmo para encontrar los caminos más cortos entre nodos en un grafo, que puede representar, por ejemplo, redes de carreteras. diff --git a/src/algorithms/graph/dijkstra/README.fr-FR.md b/src/algorithms/graph/dijkstra/README.fr-FR.md index 4c254e4ca0..810ac5cca1 100644 --- a/src/algorithms/graph/dijkstra/README.fr-FR.md +++ b/src/algorithms/graph/dijkstra/README.fr-FR.md @@ -11,7 +11,7 @@ _Lire ceci dans d’autres langues :_ [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) L’algorithme de Dijkstra est un algorithme permettant de trouver les plus courts chemins entre des nœuds dans un graphe, pouvant représenter, par exemple, un réseau routier. diff --git a/src/algorithms/graph/dijkstra/README.he-IL.md b/src/algorithms/graph/dijkstra/README.he-IL.md index 734d6449a2..e10e3dc401 100644 --- a/src/algorithms/graph/dijkstra/README.he-IL.md +++ b/src/algorithms/graph/dijkstra/README.he-IL.md @@ -11,7 +11,7 @@ _קרא בשפות אחרות:_ [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) אלגוריתם דייקסטרה הוא אלגוריתם למציאת המסלולים הקצרים ביותר בין צמתים בגרף, שיכול לייצג למשל רשת כבישים. diff --git a/src/algorithms/graph/dijkstra/README.ja-JP.md b/src/algorithms/graph/dijkstra/README.ja-JP.md index dc178bd2be..a9f204b547 100644 --- a/src/algorithms/graph/dijkstra/README.ja-JP.md +++ b/src/algorithms/graph/dijkstra/README.ja-JP.md @@ -11,7 +11,7 @@ _他の言語で読む:_ [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ダイクストラ法は、グラフ内のノード間の最短経路を見つけるためのアルゴリズムです。 例えば道路網などを表すことができます。 diff --git a/src/algorithms/graph/dijkstra/README.ko-KR.md b/src/algorithms/graph/dijkstra/README.ko-KR.md index 6b29f0a269..6b40028123 100644 --- a/src/algorithms/graph/dijkstra/README.ko-KR.md +++ b/src/algorithms/graph/dijkstra/README.ko-KR.md @@ -11,7 +11,7 @@ _다른 언어로 읽기:_ [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) 다익스트라 알고리즘은 그래프의 노드 간 최단 경로를 찾는 알고리즘으로, 예를 들어 도로망을 표현할 수 있습니다. diff --git a/src/algorithms/graph/dijkstra/README.md b/src/algorithms/graph/dijkstra/README.md index aa1feaad70..b4f21dab01 100644 --- a/src/algorithms/graph/dijkstra/README.md +++ b/src/algorithms/graph/dijkstra/README.md @@ -10,7 +10,7 @@ _Read this in other languages:_ [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Dijkstra's algorithm is an algorithm for finding the shortest paths between nodes in a graph, which may represent, for example, diff --git a/src/algorithms/graph/dijkstra/README.tel-IN.md b/src/algorithms/graph/dijkstra/README.te-IN.md similarity index 100% rename from src/algorithms/graph/dijkstra/README.tel-IN.md rename to src/algorithms/graph/dijkstra/README.te-IN.md diff --git a/src/algorithms/graph/dijkstra/README.uk-UA.md b/src/algorithms/graph/dijkstra/README.uk-UA.md index 021e8ecf27..d4e2f4d053 100644 --- a/src/algorithms/graph/dijkstra/README.uk-UA.md +++ b/src/algorithms/graph/dijkstra/README.uk-UA.md @@ -11,7 +11,7 @@ _Читайте іншими мовами:_ [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Алгоритм Дейкстри — це алгоритм пошуку найкоротших шляхів між вершинами графа, який може представляти, наприклад, дорожню мережу. diff --git a/src/algorithms/graph/dijkstra/README.zh-CN.md b/src/algorithms/graph/dijkstra/README.zh-CN.md index d3be06c91e..b7b3094556 100644 --- a/src/algorithms/graph/dijkstra/README.zh-CN.md +++ b/src/algorithms/graph/dijkstra/README.zh-CN.md @@ -11,7 +11,7 @@ _阅读其他语言版本:_ [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Dijkstra 算法是一种用于在图中查找节点之间最短路径的算法,例如,它可以用于表示道路网络。 diff --git a/src/algorithms/graph/dijkstra/README.zh-TW.md b/src/algorithms/graph/dijkstra/README.zh-TW.md index d3ef78aa0a..72ffb80773 100644 --- a/src/algorithms/graph/dijkstra/README.zh-TW.md +++ b/src/algorithms/graph/dijkstra/README.zh-TW.md @@ -11,7 +11,7 @@ _以其他語言閱讀:_ [_Français_](README.fr-FR.md), [_Deutsch_](README.de-DE.md), [_עברית_](README.he-IL.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Dijkstra 演算法是一種用於在圖中尋找節點之間最短路徑的演算法,例如,它可用於表示道路網絡。 diff --git a/src/algorithms/graph/eulerian-path/README.md b/src/algorithms/graph/eulerian-path/README.md index a8afa25707..3f6dd61d8d 100644 --- a/src/algorithms/graph/eulerian-path/README.md +++ b/src/algorithms/graph/eulerian-path/README.md @@ -1,7 +1,7 @@ # Eulerian Path _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In graph theory, an **Eulerian trail** (or **Eulerian path**) is a trail in a finite graph which visits every edge exactly once. diff --git a/src/algorithms/graph/eulerian-path/README.tel-IN.md b/src/algorithms/graph/eulerian-path/README.te-IN.md similarity index 100% rename from src/algorithms/graph/eulerian-path/README.tel-IN.md rename to src/algorithms/graph/eulerian-path/README.te-IN.md diff --git a/src/algorithms/graph/floyd-warshall/README.md b/src/algorithms/graph/floyd-warshall/README.md index feef9cd85a..4e7975a480 100644 --- a/src/algorithms/graph/floyd-warshall/README.md +++ b/src/algorithms/graph/floyd-warshall/README.md @@ -1,7 +1,7 @@ # Floyd–Warshall Algorithm _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In computer science, the **Floyd–Warshall algorithm** is an algorithm for finding shortest paths in a weighted graph with positive or negative edge weights (but diff --git a/src/algorithms/graph/floyd-warshall/README.tel-IN.md b/src/algorithms/graph/floyd-warshall/README.te-IN.md similarity index 100% rename from src/algorithms/graph/floyd-warshall/README.tel-IN.md rename to src/algorithms/graph/floyd-warshall/README.te-IN.md diff --git a/src/algorithms/graph/hamiltonian-cycle/README.md b/src/algorithms/graph/hamiltonian-cycle/README.md index 7d0ebaf1bc..c014f0ab71 100644 --- a/src/algorithms/graph/hamiltonian-cycle/README.md +++ b/src/algorithms/graph/hamiltonian-cycle/README.md @@ -1,7 +1,7 @@ # Hamiltonian Path _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) **Hamiltonian path** (or **traceable path**) is a path in an undirected or directed graph that visits each vertex exactly once. diff --git a/src/algorithms/graph/hamiltonian-cycle/README.tel-IN.md b/src/algorithms/graph/hamiltonian-cycle/README.te-IN.md similarity index 100% rename from src/algorithms/graph/hamiltonian-cycle/README.tel-IN.md rename to src/algorithms/graph/hamiltonian-cycle/README.te-IN.md diff --git a/src/algorithms/graph/kruskal/README.md b/src/algorithms/graph/kruskal/README.md index dca131b1a4..2538e95347 100644 --- a/src/algorithms/graph/kruskal/README.md +++ b/src/algorithms/graph/kruskal/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [_한국어_](README.ko-KR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Kruskal's algorithm is a minimum-spanning-tree algorithm which finds an edge of the least possible weight that connects any two diff --git a/src/algorithms/graph/kruskal/README.tel-IN.md b/src/algorithms/graph/kruskal/README.te-IN.md similarity index 100% rename from src/algorithms/graph/kruskal/README.tel-IN.md rename to src/algorithms/graph/kruskal/README.te-IN.md diff --git a/src/algorithms/graph/prim/README.md b/src/algorithms/graph/prim/README.md index 6f616aaa78..27fd912996 100644 --- a/src/algorithms/graph/prim/README.md +++ b/src/algorithms/graph/prim/README.md @@ -1,7 +1,7 @@ # Prim's Algorithm _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In computer science, **Prim's algorithm** is a greedy algorithm that finds a minimum spanning tree for a weighted undirected graph. diff --git a/src/algorithms/graph/prim/README.tel-IN.md b/src/algorithms/graph/prim/README.te-IN.md similarity index 100% rename from src/algorithms/graph/prim/README.tel-IN.md rename to src/algorithms/graph/prim/README.te-IN.md diff --git a/src/algorithms/graph/strongly-connected-components/README.md b/src/algorithms/graph/strongly-connected-components/README.md index a11b281319..ae2a7e351a 100644 --- a/src/algorithms/graph/strongly-connected-components/README.md +++ b/src/algorithms/graph/strongly-connected-components/README.md @@ -1,7 +1,7 @@ # Strongly Connected Component _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) A directed graph is called **strongly connected** if there is a path in each direction between each pair of vertices of the graph. diff --git a/src/algorithms/graph/strongly-connected-components/README.tel-IN.md b/src/algorithms/graph/strongly-connected-components/README.te-IN.md similarity index 100% rename from src/algorithms/graph/strongly-connected-components/README.tel-IN.md rename to src/algorithms/graph/strongly-connected-components/README.te-IN.md diff --git a/src/algorithms/graph/topological-sorting/README.md b/src/algorithms/graph/topological-sorting/README.md index 1bc4c364f4..e8693e6cae 100644 --- a/src/algorithms/graph/topological-sorting/README.md +++ b/src/algorithms/graph/topological-sorting/README.md @@ -1,7 +1,7 @@ # Topological Sorting _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In the field of computer science, a topological sort or topological ordering of a directed graph is a linear ordering diff --git a/src/algorithms/graph/topological-sorting/README.tel-IN.md b/src/algorithms/graph/topological-sorting/README.te-IN.md similarity index 100% rename from src/algorithms/graph/topological-sorting/README.tel-IN.md rename to src/algorithms/graph/topological-sorting/README.te-IN.md diff --git a/src/algorithms/graph/travelling-salesman/README.md b/src/algorithms/graph/travelling-salesman/README.md index cee50a9862..68baccb27f 100644 --- a/src/algorithms/graph/travelling-salesman/README.md +++ b/src/algorithms/graph/travelling-salesman/README.md @@ -1,7 +1,7 @@ # Travelling Salesman Problem _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The travelling salesman problem (TSP) asks the following question: "Given a list of cities and the distances between each pair of diff --git a/src/algorithms/graph/travelling-salesman/README.tel-IN.md b/src/algorithms/graph/travelling-salesman/README.te-IN.md similarity index 100% rename from src/algorithms/graph/travelling-salesman/README.tel-IN.md rename to src/algorithms/graph/travelling-salesman/README.te-IN.md diff --git a/src/algorithms/image-processing/seam-carving/README.md b/src/algorithms/image-processing/seam-carving/README.md index b860283cf1..7c76c85385 100644 --- a/src/algorithms/image-processing/seam-carving/README.md +++ b/src/algorithms/image-processing/seam-carving/README.md @@ -1,7 +1,7 @@ # Content-aware image resizing in JavaScript _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ![Content-aware image resizing in JavaScript](https://raw.githubusercontent.com/trekhleb/trekhleb.github.io/master/src/posts/2021/content-aware-image-resizing-in-javascript/assets/01-cover-02.png) diff --git a/src/algorithms/image-processing/seam-carving/README.tel-IN.md b/src/algorithms/image-processing/seam-carving/README.te-IN.md similarity index 100% rename from src/algorithms/image-processing/seam-carving/README.tel-IN.md rename to src/algorithms/image-processing/seam-carving/README.te-IN.md diff --git a/src/algorithms/linked-list/reverse-traversal/README.md b/src/algorithms/linked-list/reverse-traversal/README.md index da693b4e46..2ff5cc92eb 100644 --- a/src/algorithms/linked-list/reverse-traversal/README.md +++ b/src/algorithms/linked-list/reverse-traversal/README.md @@ -3,7 +3,7 @@ _Read this in other languages:_ [_中文_](README.zh-CN.md), [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The task is to traverse the given linked list in reversed order. diff --git a/src/algorithms/linked-list/reverse-traversal/README.pt-BR.md b/src/algorithms/linked-list/reverse-traversal/README.pt-BR.md index 0ba1ce2054..6bc1fbbe7c 100644 --- a/src/algorithms/linked-list/reverse-traversal/README.pt-BR.md +++ b/src/algorithms/linked-list/reverse-traversal/README.pt-BR.md @@ -3,7 +3,7 @@ _Leia isso em outros idiomas:_ [_中文_](README.zh-CN.md), [_English_](README.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) A tarefa é percorrer a lista encadeada fornecida em ordem inversa. diff --git a/src/algorithms/linked-list/reverse-traversal/README.tel-IN.md b/src/algorithms/linked-list/reverse-traversal/README.te-IN.md similarity index 100% rename from src/algorithms/linked-list/reverse-traversal/README.tel-IN.md rename to src/algorithms/linked-list/reverse-traversal/README.te-IN.md diff --git a/src/algorithms/linked-list/traversal/README.md b/src/algorithms/linked-list/traversal/README.md index 580ea492c4..007bf42e2c 100644 --- a/src/algorithms/linked-list/traversal/README.md +++ b/src/algorithms/linked-list/traversal/README.md @@ -4,7 +4,7 @@ _Read this in other languages:_ [_Русский_](README.ru-RU.md), [_中文_](README.zh-CN.md), [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The task is to traverse the given linked list in straight order. diff --git a/src/algorithms/linked-list/traversal/README.pt-BR.md b/src/algorithms/linked-list/traversal/README.pt-BR.md index bb0688025e..e18e0af7c0 100644 --- a/src/algorithms/linked-list/traversal/README.pt-BR.md +++ b/src/algorithms/linked-list/traversal/README.pt-BR.md @@ -4,7 +4,7 @@ _Leia isso em outros idiomas:_ [_Русский_](README.ru-RU.md), [_中文_](README.zh-CN.md), [_English_](README.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) A tarefa é percorrer a lista encadeada fornecida em ordem direta. diff --git a/src/algorithms/linked-list/traversal/README.tel-IN.md b/src/algorithms/linked-list/traversal/README.te-IN.md similarity index 100% rename from src/algorithms/linked-list/traversal/README.tel-IN.md rename to src/algorithms/linked-list/traversal/README.te-IN.md diff --git a/src/algorithms/math/binary-floating-point/README.md b/src/algorithms/math/binary-floating-point/README.md index a4a37b6eab..ff2f0aa1f6 100644 --- a/src/algorithms/math/binary-floating-point/README.md +++ b/src/algorithms/math/binary-floating-point/README.md @@ -1,7 +1,7 @@ # Binary representation of floating-point numbers _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Have you ever wondered how computers store the floating-point numbers like `3.1416` (𝝿) or `9.109 × 10⁻³¹` (the mass of the electron in kg) in the memory which is limited by a finite number of ones and zeroes (aka bits)? diff --git a/src/algorithms/math/binary-floating-point/README.tel-IN.md b/src/algorithms/math/binary-floating-point/README.te-IN.md similarity index 100% rename from src/algorithms/math/binary-floating-point/README.tel-IN.md rename to src/algorithms/math/binary-floating-point/README.te-IN.md diff --git a/src/algorithms/math/bits/README.fr-FR.md b/src/algorithms/math/bits/README.fr-FR.md index 4c4598b952..5cd6ee96be 100644 --- a/src/algorithms/math/bits/README.fr-FR.md +++ b/src/algorithms/math/bits/README.fr-FR.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [english](README.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). #### Vérifier un bit (_get_) diff --git a/src/algorithms/math/bits/README.md b/src/algorithms/math/bits/README.md index f8e60871c9..d559171fdd 100644 --- a/src/algorithms/math/bits/README.md +++ b/src/algorithms/math/bits/README.md @@ -3,7 +3,7 @@ _Read this in other languages:_ [français](README.fr-FR.md), [简体中文](README.zh-CN.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). #### Get Bit diff --git a/src/algorithms/math/bits/README.tel-IN.md b/src/algorithms/math/bits/README.te-IN.md similarity index 100% rename from src/algorithms/math/bits/README.tel-IN.md rename to src/algorithms/math/bits/README.te-IN.md diff --git a/src/algorithms/math/bits/README.zh-CN.md b/src/algorithms/math/bits/README.zh-CN.md index 139c0d54a8..1986976aeb 100644 --- a/src/algorithms/math/bits/README.zh-CN.md +++ b/src/algorithms/math/bits/README.zh-CN.md @@ -3,7 +3,7 @@ _Read this in other languages:_ [français](README.fr-FR.md), [english](README.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) #### Get Bit diff --git a/src/algorithms/math/complex-number/README.fr-FR.md b/src/algorithms/math/complex-number/README.fr-FR.md index 31c5ae616d..57e42e1fdc 100644 --- a/src/algorithms/math/complex-number/README.fr-FR.md +++ b/src/algorithms/math/complex-number/README.fr-FR.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [english](README.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). Un **nombre complexe** est un nombre qui peut s'écrire sous la forme `a + b * i`, tels que `a` et `b` sont des nombres réels, diff --git a/src/algorithms/math/complex-number/README.md b/src/algorithms/math/complex-number/README.md index fc686e2273..12311105b9 100644 --- a/src/algorithms/math/complex-number/README.md +++ b/src/algorithms/math/complex-number/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [français](README.fr-FR.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). A **complex number** is a number that can be expressed in the form `a + b * i`, where `a` and `b` are real numbers, and `i` is a solution of diff --git a/src/algorithms/math/complex-number/README.tel-IN.md b/src/algorithms/math/complex-number/README.te-IN.md similarity index 100% rename from src/algorithms/math/complex-number/README.tel-IN.md rename to src/algorithms/math/complex-number/README.te-IN.md diff --git a/src/algorithms/math/euclidean-algorithm/README.fr-FR.md b/src/algorithms/math/euclidean-algorithm/README.fr-FR.md index 6e39ead358..52420e1919 100644 --- a/src/algorithms/math/euclidean-algorithm/README.fr-FR.md +++ b/src/algorithms/math/euclidean-algorithm/README.fr-FR.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [english](README.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). En mathématiques, l'algorithme d'Euclide est un algorithme qui calcule le plus grand commun diviseur (PGCD) de deux entiers, c'est-à-dire le plus grand entier qui divise les deux entiers, en laissant un reste nul. L'algorithme ne connaît pas la factorisation de ces deux nombres. diff --git a/src/algorithms/math/euclidean-algorithm/README.md b/src/algorithms/math/euclidean-algorithm/README.md index d521f20b84..fe8a0b537b 100644 --- a/src/algorithms/math/euclidean-algorithm/README.md +++ b/src/algorithms/math/euclidean-algorithm/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [français](README.fr-FR.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). In mathematics, the Euclidean algorithm, or Euclid's algorithm, is an efficient method for computing the greatest common divisor diff --git a/src/algorithms/math/euclidean-algorithm/README.tel-IN.md b/src/algorithms/math/euclidean-algorithm/README.te-IN.md similarity index 100% rename from src/algorithms/math/euclidean-algorithm/README.tel-IN.md rename to src/algorithms/math/euclidean-algorithm/README.te-IN.md diff --git a/src/algorithms/math/euclidean-distance/README.md b/src/algorithms/math/euclidean-distance/README.md index 7e75d750ec..4586b1e4c9 100644 --- a/src/algorithms/math/euclidean-distance/README.md +++ b/src/algorithms/math/euclidean-distance/README.md @@ -1,7 +1,7 @@ # Euclidean Distance _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In mathematics, the **Euclidean distance** between two points in Euclidean space is the length of a line segment between the two points. It can be calculated from the Cartesian coordinates of the points using the Pythagorean theorem, therefore occasionally being called the Pythagorean distance. diff --git a/src/algorithms/math/euclidean-distance/README.tel-IN.md b/src/algorithms/math/euclidean-distance/README.te-IN.md similarity index 100% rename from src/algorithms/math/euclidean-distance/README.tel-IN.md rename to src/algorithms/math/euclidean-distance/README.te-IN.md diff --git a/src/algorithms/math/factorial/README.fr-FR.md b/src/algorithms/math/factorial/README.fr-FR.md index d5573b7ff7..34839098bd 100644 --- a/src/algorithms/math/factorial/README.fr-FR.md +++ b/src/algorithms/math/factorial/README.fr-FR.md @@ -2,7 +2,7 @@ _Lisez ceci dans d'autres langues:_ [english](README.md), [_简体中文_](README.zh-CN.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). En mathématiques, la factorielle d'un entier naturel `n`, notée avec un point d'exclamation `n!`, est le produit des nombres entiers diff --git a/src/algorithms/math/factorial/README.md b/src/algorithms/math/factorial/README.md index 867a9b53dc..38913211c4 100644 --- a/src/algorithms/math/factorial/README.md +++ b/src/algorithms/math/factorial/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [_简体中文_](README.zh-CN.md), [_Français_](README.fr-FR.md), [_Türkçe_](README.tr-TR.md), [_ქართული_](README.ka-GE.md), [_Українська_](README.uk-UA.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). In mathematics, the factorial of a non-negative integer `n`, denoted by `n!`, is the product of all positive integers less diff --git a/src/algorithms/math/factorial/README.tel-IN.md b/src/algorithms/math/factorial/README.te-IN.md similarity index 100% rename from src/algorithms/math/factorial/README.tel-IN.md rename to src/algorithms/math/factorial/README.te-IN.md diff --git a/src/algorithms/math/factorial/README.tr-TR.md b/src/algorithms/math/factorial/README.tr-TR.md index 4e05a8388a..f15685a956 100644 --- a/src/algorithms/math/factorial/README.tr-TR.md +++ b/src/algorithms/math/factorial/README.tr-TR.md @@ -2,7 +2,7 @@ _Bunu diğer dillerde okuyun:_ [_简体中文_](README.zh-CN.md), [français](README.fr-FR.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). Faktöriyel, matematikte, sağına ünlem işareti konulmuş sayıya verilen isim, daha genel olan Gama fonksiyonunun tam sayılarla diff --git a/src/algorithms/math/factorial/README.uk-UA.md b/src/algorithms/math/factorial/README.uk-UA.md index 9706e95b79..f6f6f9255e 100644 --- a/src/algorithms/math/factorial/README.uk-UA.md +++ b/src/algorithms/math/factorial/README.uk-UA.md @@ -2,7 +2,7 @@ _Прочитайте це іншими мовами:_ [_English_](README.md), [_简体中文_](README.zh-CN.md), [_Français_](README.fr-FR.md), [_Türkçe_](README.tr-TR.md), [_ქართული_](README.ka-GE.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). У математиці факторіал невід'ємного цілого числа `n`, позначений `n!`, є добутком усіх натуральних чисел, менших або рівних `n`. Наприклад: diff --git a/src/algorithms/math/fast-powering/README.fr-FR.md b/src/algorithms/math/fast-powering/README.fr-FR.md index 0efae4c22a..790bc06298 100644 --- a/src/algorithms/math/fast-powering/README.fr-FR.md +++ b/src/algorithms/math/fast-powering/README.fr-FR.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [english](README.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). En algèbre, une **puissance** d'un nombre est le résultat de la multiplication répétée de ce nombre avec lui-même. diff --git a/src/algorithms/math/fast-powering/README.md b/src/algorithms/math/fast-powering/README.md index 819002ba9d..37b308a6a1 100644 --- a/src/algorithms/math/fast-powering/README.md +++ b/src/algorithms/math/fast-powering/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [français](README.fr-FR.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). **The power of a number** says how many times to use the number in a multiplication. diff --git a/src/algorithms/math/fast-powering/README.tel-IN.md b/src/algorithms/math/fast-powering/README.te-IN.md similarity index 100% rename from src/algorithms/math/fast-powering/README.tel-IN.md rename to src/algorithms/math/fast-powering/README.te-IN.md diff --git a/src/algorithms/math/fibonacci/README.fr-FR.md b/src/algorithms/math/fibonacci/README.fr-FR.md index dd0d14e513..e263f5874f 100644 --- a/src/algorithms/math/fibonacci/README.fr-FR.md +++ b/src/algorithms/math/fibonacci/README.fr-FR.md @@ -3,7 +3,7 @@ _Read this in other languages:_ [english](README.md), [ქართული](README.ka-GE.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). En mathématiques, la suite de Fibonacci est une suite d'entiers dans laquelle chaque terme (après les deux premiers) diff --git a/src/algorithms/math/fibonacci/README.md b/src/algorithms/math/fibonacci/README.md index df1089e1bf..379785fd22 100644 --- a/src/algorithms/math/fibonacci/README.md +++ b/src/algorithms/math/fibonacci/README.md @@ -4,7 +4,7 @@ _Read this in other languages:_ [français](README.fr-FR.md), [简体中文](README.zh-CN.md), [ქართული](README.ka-GE.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). In mathematics, the Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and characterized by diff --git a/src/algorithms/math/fibonacci/README.tel-IN.md b/src/algorithms/math/fibonacci/README.te-IN.md similarity index 100% rename from src/algorithms/math/fibonacci/README.tel-IN.md rename to src/algorithms/math/fibonacci/README.te-IN.md diff --git a/src/algorithms/math/fibonacci/README.zh-CN.md b/src/algorithms/math/fibonacci/README.zh-CN.md index 724c0cd925..5bcf6e9a79 100644 --- a/src/algorithms/math/fibonacci/README.zh-CN.md +++ b/src/algorithms/math/fibonacci/README.zh-CN.md @@ -4,7 +4,7 @@ _Read this in other languages:_ [français](README.fr-FR.md), [english](README.md), [ქართული](README.ka-GE.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). 在数学中,斐波那契数是以下整数序列(称为斐波那契数列)中的数字,其特征在于前两个数字之后的每个数字都是前两个数字的和: diff --git a/src/algorithms/math/fourier-transform/README.fr-FR.md b/src/algorithms/math/fourier-transform/README.fr-FR.md index 36df4279f4..b2f9a44412 100644 --- a/src/algorithms/math/fourier-transform/README.fr-FR.md +++ b/src/algorithms/math/fourier-transform/README.fr-FR.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [english](README.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). ## Définitions diff --git a/src/algorithms/math/fourier-transform/README.md b/src/algorithms/math/fourier-transform/README.md index fd7fbbf742..e0bfc02f11 100644 --- a/src/algorithms/math/fourier-transform/README.md +++ b/src/algorithms/math/fourier-transform/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [français](README.fr-FR.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). ## Definitions diff --git a/src/algorithms/math/fourier-transform/README.tel-IN.md b/src/algorithms/math/fourier-transform/README.te-IN.md similarity index 100% rename from src/algorithms/math/fourier-transform/README.tel-IN.md rename to src/algorithms/math/fourier-transform/README.te-IN.md diff --git a/src/algorithms/math/horner-method/README.md b/src/algorithms/math/horner-method/README.md index 7d38711687..7d0916a02c 100644 --- a/src/algorithms/math/horner-method/README.md +++ b/src/algorithms/math/horner-method/README.md @@ -1,7 +1,7 @@ # Horner's Method _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In mathematics, Horner's method (or Horner's scheme) is an algorithm for polynomial evaluation. With this method, it is possible to evaluate a polynomial with only `n` additions and `n` multiplications. Hence, its storage requirements are `n` times the number of bits of `x`. diff --git a/src/algorithms/math/horner-method/README.tel-IN.md b/src/algorithms/math/horner-method/README.te-IN.md similarity index 100% rename from src/algorithms/math/horner-method/README.tel-IN.md rename to src/algorithms/math/horner-method/README.te-IN.md diff --git a/src/algorithms/math/integer-partition/README.md b/src/algorithms/math/integer-partition/README.md index fb01048d0c..b3db875f90 100644 --- a/src/algorithms/math/integer-partition/README.md +++ b/src/algorithms/math/integer-partition/README.md @@ -1,7 +1,7 @@ # Integer Partition _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In number theory and combinatorics, a partition of a positive integer `n`, also called an **integer partition**, is a way of diff --git a/src/algorithms/math/integer-partition/README.tel-IN.md b/src/algorithms/math/integer-partition/README.te-IN.md similarity index 100% rename from src/algorithms/math/integer-partition/README.tel-IN.md rename to src/algorithms/math/integer-partition/README.te-IN.md diff --git a/src/algorithms/math/is-power-of-two/README.md b/src/algorithms/math/is-power-of-two/README.md index 107189e872..3516e1f608 100644 --- a/src/algorithms/math/is-power-of-two/README.md +++ b/src/algorithms/math/is-power-of-two/README.md @@ -1,7 +1,7 @@ # Is a power of two _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Given a positive integer, write a function to find if it is a power of two or not. diff --git a/src/algorithms/math/is-power-of-two/README.tel-IN.md b/src/algorithms/math/is-power-of-two/README.te-IN.md similarity index 100% rename from src/algorithms/math/is-power-of-two/README.tel-IN.md rename to src/algorithms/math/is-power-of-two/README.te-IN.md diff --git a/src/algorithms/math/least-common-multiple/README.md b/src/algorithms/math/least-common-multiple/README.md index a7296f9118..6245d75c79 100644 --- a/src/algorithms/math/least-common-multiple/README.md +++ b/src/algorithms/math/least-common-multiple/README.md @@ -1,7 +1,7 @@ # Least common multiple _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In arithmetic and number theory, the least common multiple, lowest common multiple, or smallest common multiple of diff --git a/src/algorithms/math/least-common-multiple/README.tel-IN.md b/src/algorithms/math/least-common-multiple/README.te-IN.md similarity index 100% rename from src/algorithms/math/least-common-multiple/README.tel-IN.md rename to src/algorithms/math/least-common-multiple/README.te-IN.md diff --git a/src/algorithms/math/liu-hui/README.md b/src/algorithms/math/liu-hui/README.md index ae817127a3..47b69e13ae 100644 --- a/src/algorithms/math/liu-hui/README.md +++ b/src/algorithms/math/liu-hui/README.md @@ -1,7 +1,7 @@ # Liu Hui's π Algorithm _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Liu Hui remarked in his commentary to The Nine Chapters on the Mathematical Art, that the ratio of the circumference of an inscribed hexagon to the diameter of diff --git a/src/algorithms/math/liu-hui/README.tel-IN.md b/src/algorithms/math/liu-hui/README.te-IN.md similarity index 100% rename from src/algorithms/math/liu-hui/README.tel-IN.md rename to src/algorithms/math/liu-hui/README.te-IN.md diff --git a/src/algorithms/math/matrix/README.md b/src/algorithms/math/matrix/README.md index f1649894cd..8a951500f8 100644 --- a/src/algorithms/math/matrix/README.md +++ b/src/algorithms/math/matrix/README.md @@ -1,7 +1,7 @@ # Matrices _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In mathematics, a **matrix** (plural **matrices**) is a rectangular array or table of numbers, symbols, or expressions, arranged in rows and columns. For example, the dimension of the matrix below is `2 × 3` (read "two by three"), because there are two rows and three columns: diff --git a/src/algorithms/math/matrix/README.tel-IN.md b/src/algorithms/math/matrix/README.te-IN.md similarity index 100% rename from src/algorithms/math/matrix/README.tel-IN.md rename to src/algorithms/math/matrix/README.te-IN.md diff --git a/src/algorithms/math/pascal-triangle/README.md b/src/algorithms/math/pascal-triangle/README.md index 649120938a..b71628b374 100644 --- a/src/algorithms/math/pascal-triangle/README.md +++ b/src/algorithms/math/pascal-triangle/README.md @@ -1,7 +1,7 @@ # Pascal's Triangle _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In mathematics, **Pascal's triangle** is a triangular array of the [binomial coefficients](https://en.wikipedia.org/wiki/Binomial_coefficient). diff --git a/src/algorithms/math/pascal-triangle/README.tel-IN.md b/src/algorithms/math/pascal-triangle/README.te-IN.md similarity index 100% rename from src/algorithms/math/pascal-triangle/README.tel-IN.md rename to src/algorithms/math/pascal-triangle/README.te-IN.md diff --git a/src/algorithms/math/primality-test/README.md b/src/algorithms/math/primality-test/README.md index b4b1877351..570ed75c43 100644 --- a/src/algorithms/math/primality-test/README.md +++ b/src/algorithms/math/primality-test/README.md @@ -1,7 +1,7 @@ # Primality Test _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) A **prime number** (or a **prime**) is a natural number greater than `1` that cannot be formed by multiplying two smaller natural numbers. A natural number diff --git a/src/algorithms/math/primality-test/README.tel-IN.md b/src/algorithms/math/primality-test/README.te-IN.md similarity index 100% rename from src/algorithms/math/primality-test/README.tel-IN.md rename to src/algorithms/math/primality-test/README.te-IN.md diff --git a/src/algorithms/math/prime-factors/README.md b/src/algorithms/math/prime-factors/README.md index 6d32ca95d1..d94fac14aa 100644 --- a/src/algorithms/math/prime-factors/README.md +++ b/src/algorithms/math/prime-factors/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [简体中文](README.zh-CN.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). **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. diff --git a/src/algorithms/math/prime-factors/README.tel-IN.md b/src/algorithms/math/prime-factors/README.te-IN.md similarity index 100% rename from src/algorithms/math/prime-factors/README.tel-IN.md rename to src/algorithms/math/prime-factors/README.te-IN.md diff --git a/src/algorithms/math/prime-factors/README.zh-CN.md b/src/algorithms/math/prime-factors/README.zh-CN.md index 1d6807b745..61915c13dd 100644 --- a/src/algorithms/math/prime-factors/README.zh-CN.md +++ b/src/algorithms/math/prime-factors/README.zh-CN.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [english](README.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). **质数** 是一个比 `1` 大的整数,且 **不能**由其它整数相乘得出。前几个质数是: `2`, `3`, `5`, `7`, `11`, `13`, `17`, `19`,依此类推。 diff --git a/src/algorithms/math/radian/README.md b/src/algorithms/math/radian/README.md index 5164755e8d..b49892d8bd 100644 --- a/src/algorithms/math/radian/README.md +++ b/src/algorithms/math/radian/README.md @@ -1,7 +1,7 @@ # Radian _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The **radian** (symbol **rad**) is the unit for measuring angles, and is the standard unit of angular measure used in many areas of mathematics. diff --git a/src/algorithms/math/radian/README.tel-IN.md b/src/algorithms/math/radian/README.te-IN.md similarity index 100% rename from src/algorithms/math/radian/README.tel-IN.md rename to src/algorithms/math/radian/README.te-IN.md diff --git a/src/algorithms/math/sieve-of-eratosthenes/README.md b/src/algorithms/math/sieve-of-eratosthenes/README.md index 90646028a0..afaae81350 100644 --- a/src/algorithms/math/sieve-of-eratosthenes/README.md +++ b/src/algorithms/math/sieve-of-eratosthenes/README.md @@ -1,7 +1,7 @@ # Sieve of Eratosthenes _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The Sieve of Eratosthenes is an algorithm for finding all prime numbers up to some limit `n`. diff --git a/src/algorithms/math/sieve-of-eratosthenes/README.tel-IN.md b/src/algorithms/math/sieve-of-eratosthenes/README.te-IN.md similarity index 100% rename from src/algorithms/math/sieve-of-eratosthenes/README.tel-IN.md rename to src/algorithms/math/sieve-of-eratosthenes/README.te-IN.md diff --git a/src/algorithms/math/square-root/README.md b/src/algorithms/math/square-root/README.md index 39962f7565..50661dd43e 100644 --- a/src/algorithms/math/square-root/README.md +++ b/src/algorithms/math/square-root/README.md @@ -1,7 +1,7 @@ # Square Root (Newton's Method) _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In numerical analysis, a branch of mathematics, there are several square root algorithms or methods of computing the principal square root of a non-negative real diff --git a/src/algorithms/math/square-root/README.tel-IN.md b/src/algorithms/math/square-root/README.te-IN.md similarity index 100% rename from src/algorithms/math/square-root/README.tel-IN.md rename to src/algorithms/math/square-root/README.te-IN.md diff --git a/src/algorithms/ml/k-means/README.md b/src/algorithms/ml/k-means/README.md index 1327679eeb..19c1c7b36e 100644 --- a/src/algorithms/ml/k-means/README.md +++ b/src/algorithms/ml/k-means/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The **k-Means algorithm** is an unsupervised Machine Learning algorithm. It's a clustering algorithm, which groups the sample data on the basis of similarity between dimensions of vectors. diff --git a/src/algorithms/ml/k-means/README.pt-BR.md b/src/algorithms/ml/k-means/README.pt-BR.md index 9343f434b4..939b27b829 100644 --- a/src/algorithms/ml/k-means/README.pt-BR.md +++ b/src/algorithms/ml/k-means/README.pt-BR.md @@ -2,7 +2,7 @@ _Leia isso em outros idiomas:_ [_English_](README.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) O **algoritmo k-Means** é um algoritmo de aprendizado de máquina não supervisionado. É um algoritmo de agrupamento, que agrupa os dados da amostra com base na semelhança entre as dimensões dos vetores. diff --git a/src/algorithms/ml/k-means/README.tel-IN.md b/src/algorithms/ml/k-means/README.te-IN.md similarity index 100% rename from src/algorithms/ml/k-means/README.tel-IN.md rename to src/algorithms/ml/k-means/README.te-IN.md diff --git a/src/algorithms/ml/knn/README.md b/src/algorithms/ml/knn/README.md index be5484b881..5cdd74937d 100644 --- a/src/algorithms/ml/knn/README.md +++ b/src/algorithms/ml/knn/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The **k-nearest neighbors algorithm (k-NN)** is a supervised Machine Learning algorithm. It's a classification algorithm, determining the class of a sample vector using a sample data. diff --git a/src/algorithms/ml/knn/README.pt-BR.md b/src/algorithms/ml/knn/README.pt-BR.md index eda2b275e9..0afa8c7455 100644 --- a/src/algorithms/ml/knn/README.pt-BR.md +++ b/src/algorithms/ml/knn/README.pt-BR.md @@ -2,7 +2,7 @@ _Leia isso em outros idiomas:_ [_English_](README.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) O **algoritmo de k-vizinhos mais próximos (k-NN)** é um algoritmo de aprendizado de máquina supervisionado. É um algoritmo de classificação, determinando a classe de um vetor de amostra usando dados de amostra. diff --git a/src/algorithms/ml/knn/README.tel-IN.md b/src/algorithms/ml/knn/README.te-IN.md similarity index 100% rename from src/algorithms/ml/knn/README.tel-IN.md rename to src/algorithms/ml/knn/README.te-IN.md diff --git a/src/algorithms/search/binary-search/README.es-ES.md b/src/algorithms/search/binary-search/README.es-ES.md index a3fe910179..7d5fcc12ee 100644 --- a/src/algorithms/search/binary-search/README.es-ES.md +++ b/src/algorithms/search/binary-search/README.es-ES.md @@ -3,7 +3,7 @@ _Lea esto en otros idiomas:_ [English](README.md) [Português brasileiro](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.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 diff --git a/src/algorithms/search/binary-search/README.md b/src/algorithms/search/binary-search/README.md index 6a25f5b789..bc64de48d7 100644 --- a/src/algorithms/search/binary-search/README.md +++ b/src/algorithms/search/binary-search/README.md @@ -3,7 +3,7 @@ _Read this in other languages:_ [Português brasileiro](README.pt-BR.md). [Español](README.es-ES.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). In computer science, binary search, also known as half-interval search, logarithmic search, or binary chop, is a search algorithm diff --git a/src/algorithms/search/binary-search/README.pt-BR.md b/src/algorithms/search/binary-search/README.pt-BR.md index 80aa5c1d13..c1b7cec631 100644 --- a/src/algorithms/search/binary-search/README.pt-BR.md +++ b/src/algorithms/search/binary-search/README.pt-BR.md @@ -3,7 +3,7 @@ _Leia isso em outras línguas:_ [english](README.md). [Español](README.es-ES.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.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 que encontra a posição de um elemento alvo dentro de um diff --git a/src/algorithms/search/binary-search/README.tel-IN.md b/src/algorithms/search/binary-search/README.te-IN.md similarity index 100% rename from src/algorithms/search/binary-search/README.tel-IN.md rename to src/algorithms/search/binary-search/README.te-IN.md diff --git a/src/algorithms/search/interpolation-search/README.md b/src/algorithms/search/interpolation-search/README.md index 1feb301863..5eae9cca47 100644 --- a/src/algorithms/search/interpolation-search/README.md +++ b/src/algorithms/search/interpolation-search/README.md @@ -1,7 +1,7 @@ # Interpolation Search _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) **Interpolation search** is an algorithm for searching for a key in an array that has been ordered by numerical values assigned to the keys (key values). diff --git a/src/algorithms/search/interpolation-search/README.tel-IN.md b/src/algorithms/search/interpolation-search/README.te-IN.md similarity index 100% rename from src/algorithms/search/interpolation-search/README.tel-IN.md rename to src/algorithms/search/interpolation-search/README.te-IN.md diff --git a/src/algorithms/search/jump-search/README.md b/src/algorithms/search/jump-search/README.md index 68297546ff..e3ec3ab714 100644 --- a/src/algorithms/search/jump-search/README.md +++ b/src/algorithms/search/jump-search/README.md @@ -1,7 +1,7 @@ # Jump Search _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Like Binary Search, **Jump Search** (or **Block Search**) is a searching algorithm for sorted arrays. The basic idea is to check fewer elements (than linear search) diff --git a/src/algorithms/search/jump-search/README.tel-IN.md b/src/algorithms/search/jump-search/README.te-IN.md similarity index 100% rename from src/algorithms/search/jump-search/README.tel-IN.md rename to src/algorithms/search/jump-search/README.te-IN.md diff --git a/src/algorithms/search/linear-search/README.md b/src/algorithms/search/linear-search/README.md index e2652229be..fbcd599fb7 100644 --- a/src/algorithms/search/linear-search/README.md +++ b/src/algorithms/search/linear-search/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [Português brasileiro](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). In computer science, linear search or sequential search is a method for finding a target value within a list. It sequentially diff --git a/src/algorithms/search/linear-search/README.pt-BR.md b/src/algorithms/search/linear-search/README.pt-BR.md index 7017e0c78f..9365434e37 100644 --- a/src/algorithms/search/linear-search/README.pt-BR.md +++ b/src/algorithms/search/linear-search/README.pt-BR.md @@ -2,7 +2,7 @@ _Leia isso em outras línguas:_ [english](README.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). Na Ciência da Computação, busca linear ou busca sequencial é um método para encontrar um elemento alvo em uma lista. O algoritmo verifica sequencialmente cada elemento da lista procurando o elemento alvo até ele ser encontrado ou até ter verificado todos os elementos. diff --git a/src/algorithms/search/linear-search/README.tel-IN.md b/src/algorithms/search/linear-search/README.te-IN.md similarity index 100% rename from src/algorithms/search/linear-search/README.tel-IN.md rename to src/algorithms/search/linear-search/README.te-IN.md diff --git a/src/algorithms/sets/cartesian-product/README.md b/src/algorithms/sets/cartesian-product/README.md index 1d96b586cf..9862f3d2a3 100644 --- a/src/algorithms/sets/cartesian-product/README.md +++ b/src/algorithms/sets/cartesian-product/README.md @@ -1,7 +1,7 @@ # Cartesian Product _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In set theory a Cartesian product is a mathematical operation that returns a set (or product set or simply product) from multiple sets. That is, for sets A and B, diff --git a/src/algorithms/sets/cartesian-product/README.tel-IN.md b/src/algorithms/sets/cartesian-product/README.te-IN.md similarity index 100% rename from src/algorithms/sets/cartesian-product/README.tel-IN.md rename to src/algorithms/sets/cartesian-product/README.te-IN.md diff --git a/src/algorithms/sets/combination-sum/README.md b/src/algorithms/sets/combination-sum/README.md index b28206c043..9880a7ca85 100644 --- a/src/algorithms/sets/combination-sum/README.md +++ b/src/algorithms/sets/combination-sum/README.md @@ -1,7 +1,7 @@ # Combination Sum Problem _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Given a **set** of candidate numbers (`candidates`) **(without duplicates)** and a target number (`target`), find all unique combinations in `candidates` where diff --git a/src/algorithms/sets/combination-sum/README.tel-IN.md b/src/algorithms/sets/combination-sum/README.te-IN.md similarity index 100% rename from src/algorithms/sets/combination-sum/README.tel-IN.md rename to src/algorithms/sets/combination-sum/README.te-IN.md diff --git a/src/algorithms/sets/combinations/README.md b/src/algorithms/sets/combinations/README.md index c6a0620790..8e301d832c 100644 --- a/src/algorithms/sets/combinations/README.md +++ b/src/algorithms/sets/combinations/README.md @@ -1,7 +1,7 @@ # Combinations _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) When the order doesn't matter, it is a **Combination**. diff --git a/src/algorithms/sets/combinations/README.tel-IN.md b/src/algorithms/sets/combinations/README.te-IN.md similarity index 100% rename from src/algorithms/sets/combinations/README.tel-IN.md rename to src/algorithms/sets/combinations/README.te-IN.md diff --git a/src/algorithms/sets/fisher-yates/README.md b/src/algorithms/sets/fisher-yates/README.md index 4979df71ad..f03fb03526 100644 --- a/src/algorithms/sets/fisher-yates/README.md +++ b/src/algorithms/sets/fisher-yates/README.md @@ -1,7 +1,7 @@ # Fisher–Yates shuffle _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The Fisher–Yates shuffle is an algorithm for generating a random permutation of a finite sequence—in plain terms, the algorithm diff --git a/src/algorithms/sets/fisher-yates/README.tel-IN.md b/src/algorithms/sets/fisher-yates/README.te-IN.md similarity index 100% rename from src/algorithms/sets/fisher-yates/README.tel-IN.md rename to src/algorithms/sets/fisher-yates/README.te-IN.md diff --git a/src/algorithms/sets/knapsack-problem/README.md b/src/algorithms/sets/knapsack-problem/README.md index f3b3b16de2..d174090be4 100644 --- a/src/algorithms/sets/knapsack-problem/README.md +++ b/src/algorithms/sets/knapsack-problem/README.md @@ -1,7 +1,7 @@ # Knapsack Problem _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The knapsack problem or rucksack problem is a problem in combinatorial optimization: Given a set of items, each with diff --git a/src/algorithms/sets/knapsack-problem/README.tel-IN.md b/src/algorithms/sets/knapsack-problem/README.te-IN.md similarity index 100% rename from src/algorithms/sets/knapsack-problem/README.tel-IN.md rename to src/algorithms/sets/knapsack-problem/README.te-IN.md diff --git a/src/algorithms/sets/longest-common-subsequence/README.md b/src/algorithms/sets/longest-common-subsequence/README.md index 5c545a2e26..5810f498f6 100644 --- a/src/algorithms/sets/longest-common-subsequence/README.md +++ b/src/algorithms/sets/longest-common-subsequence/README.md @@ -1,7 +1,7 @@ # Longest common subsequence problem _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The longest common subsequence (LCS) problem is the problem of finding the longest subsequence common to all sequences in a set of sequences diff --git a/src/algorithms/sets/longest-common-subsequence/README.tel-IN.md b/src/algorithms/sets/longest-common-subsequence/README.te-IN.md similarity index 100% rename from src/algorithms/sets/longest-common-subsequence/README.tel-IN.md rename to src/algorithms/sets/longest-common-subsequence/README.te-IN.md diff --git a/src/algorithms/sets/longest-increasing-subsequence/README.md b/src/algorithms/sets/longest-increasing-subsequence/README.md index 33e3d7688c..9371e1ac27 100644 --- a/src/algorithms/sets/longest-increasing-subsequence/README.md +++ b/src/algorithms/sets/longest-increasing-subsequence/README.md @@ -1,7 +1,7 @@ # Longest Increasing Subsequence _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The longest increasing subsequence problem is to find a subsequence of a given sequence in which the subsequence's elements are in sorted order, diff --git a/src/algorithms/sets/longest-increasing-subsequence/README.tel-IN.md b/src/algorithms/sets/longest-increasing-subsequence/README.te-IN.md similarity index 100% rename from src/algorithms/sets/longest-increasing-subsequence/README.tel-IN.md rename to src/algorithms/sets/longest-increasing-subsequence/README.te-IN.md diff --git a/src/algorithms/sets/maximum-subarray/README.md b/src/algorithms/sets/maximum-subarray/README.md index bd48d8e649..9a25b8d6b3 100644 --- a/src/algorithms/sets/maximum-subarray/README.md +++ b/src/algorithms/sets/maximum-subarray/README.md @@ -1,7 +1,7 @@ # Maximum subarray problem _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The maximum subarray problem is the task of finding the contiguous subarray within a one-dimensional array, `a[1...n]`, of numbers diff --git a/src/algorithms/sets/maximum-subarray/README.tel-IN.md b/src/algorithms/sets/maximum-subarray/README.te-IN.md similarity index 100% rename from src/algorithms/sets/maximum-subarray/README.tel-IN.md rename to src/algorithms/sets/maximum-subarray/README.te-IN.md diff --git a/src/algorithms/sets/permutations/README.md b/src/algorithms/sets/permutations/README.md index e90b3701e6..920db665e1 100644 --- a/src/algorithms/sets/permutations/README.md +++ b/src/algorithms/sets/permutations/README.md @@ -1,7 +1,7 @@ # Permutations _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) When the order doesn't matter, it is a **Combination**. diff --git a/src/algorithms/sets/permutations/README.tel-IN.md b/src/algorithms/sets/permutations/README.te-IN.md similarity index 100% rename from src/algorithms/sets/permutations/README.tel-IN.md rename to src/algorithms/sets/permutations/README.te-IN.md diff --git a/src/algorithms/sets/power-set/README.md b/src/algorithms/sets/power-set/README.md index 1e74b2de4f..e197adee4a 100644 --- a/src/algorithms/sets/power-set/README.md +++ b/src/algorithms/sets/power-set/README.md @@ -1,7 +1,7 @@ # Power Set _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Power set of a set `S` is the set of all of the subsets of `S`, including the empty set and `S` itself. Power set of set `S` is denoted as `P(S)`. diff --git a/src/algorithms/sets/power-set/README.tel-IN.md b/src/algorithms/sets/power-set/README.te-IN.md similarity index 100% rename from src/algorithms/sets/power-set/README.tel-IN.md rename to src/algorithms/sets/power-set/README.te-IN.md diff --git a/src/algorithms/sets/shortest-common-supersequence/README.md b/src/algorithms/sets/shortest-common-supersequence/README.md index b70dd4de7d..5b0bd5000d 100644 --- a/src/algorithms/sets/shortest-common-supersequence/README.md +++ b/src/algorithms/sets/shortest-common-supersequence/README.md @@ -1,7 +1,7 @@ # Shortest Common Supersequence _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The shortest common supersequence (SCS) of two sequences `X` and `Y` is the shortest sequence which has `X` and `Y` as subsequences. diff --git a/src/algorithms/sets/shortest-common-supersequence/README.tel-IN.md b/src/algorithms/sets/shortest-common-supersequence/README.te-IN.md similarity index 100% rename from src/algorithms/sets/shortest-common-supersequence/README.tel-IN.md rename to src/algorithms/sets/shortest-common-supersequence/README.te-IN.md diff --git a/src/algorithms/sorting/bubble-sort/README.md b/src/algorithms/sorting/bubble-sort/README.md index 17f6b32426..57069b6ad0 100644 --- a/src/algorithms/sorting/bubble-sort/README.md +++ b/src/algorithms/sorting/bubble-sort/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through diff --git a/src/algorithms/sorting/bubble-sort/README.pt-BR.md b/src/algorithms/sorting/bubble-sort/README.pt-BR.md index 70c4623f01..f4f60ff834 100644 --- a/src/algorithms/sorting/bubble-sort/README.pt-BR.md +++ b/src/algorithms/sorting/bubble-sort/README.pt-BR.md @@ -2,7 +2,7 @@ _Leia isso em outros idiomas:_ [_English_](README.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) O bubble sort, ou ordenação por flutuação (literalmente "por bolha"), é um algoritmo de ordenação dos mais simples. A ideia é percorrer o vetor diversas vezes, e a cada passagem fazer flutuar para o topo o maior elemento da sequência. Essa movimentação lembra a forma como as bolhas em um tanque de água procuram seu próprio nível, e disso vem o nome do algoritmo. diff --git a/src/algorithms/sorting/bubble-sort/README.tel-IN.md b/src/algorithms/sorting/bubble-sort/README.te-IN.md similarity index 100% rename from src/algorithms/sorting/bubble-sort/README.tel-IN.md rename to src/algorithms/sorting/bubble-sort/README.te-IN.md diff --git a/src/algorithms/sorting/bucket-sort/README.md b/src/algorithms/sorting/bucket-sort/README.md index fee41cab9d..bb79b08c70 100644 --- a/src/algorithms/sorting/bucket-sort/README.md +++ b/src/algorithms/sorting/bucket-sort/README.md @@ -1,7 +1,7 @@ # Bucket Sort _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) **Bucket sort**, or **bin sort**, is a sorting algorithm that works by distributing the elements of an array into a number of buckets. Each bucket is then sorted individually, either using a different sorting algorithm, or by recursively applying the bucket sorting algorithm. diff --git a/src/algorithms/sorting/bucket-sort/README.tel-IN.md b/src/algorithms/sorting/bucket-sort/README.te-IN.md similarity index 100% rename from src/algorithms/sorting/bucket-sort/README.tel-IN.md rename to src/algorithms/sorting/bucket-sort/README.te-IN.md diff --git a/src/algorithms/sorting/counting-sort/README.md b/src/algorithms/sorting/counting-sort/README.md index e221013443..1da4946d7f 100644 --- a/src/algorithms/sorting/counting-sort/README.md +++ b/src/algorithms/sorting/counting-sort/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In computer science, **counting sort** is an algorithm for sorting a collection of objects according to keys that are small integers; diff --git a/src/algorithms/sorting/counting-sort/README.pt-br.md b/src/algorithms/sorting/counting-sort/README.pt-br.md index 0feafc8793..ae4502942b 100644 --- a/src/algorithms/sorting/counting-sort/README.pt-br.md +++ b/src/algorithms/sorting/counting-sort/README.pt-br.md @@ -2,7 +2,7 @@ _Leia isso em outros idiomas:_ [_English_](README.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Em ciência da computação, **counting sort** é um algoritmo para ordenar uma coleção de objetos de acordo com chaves que são pequenos inteiros; diff --git a/src/algorithms/sorting/counting-sort/README.tel-IN.md b/src/algorithms/sorting/counting-sort/README.te-IN.md similarity index 100% rename from src/algorithms/sorting/counting-sort/README.tel-IN.md rename to src/algorithms/sorting/counting-sort/README.te-IN.md diff --git a/src/algorithms/sorting/heap-sort/README.md b/src/algorithms/sorting/heap-sort/README.md index f82559f104..5531dce18d 100644 --- a/src/algorithms/sorting/heap-sort/README.md +++ b/src/algorithms/sorting/heap-sort/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Heapsort is a comparison-based sorting algorithm. Heapsort can be thought of as an improved selection diff --git a/src/algorithms/sorting/heap-sort/README.pt-BR.md b/src/algorithms/sorting/heap-sort/README.pt-BR.md index 60d21f6be9..848fc34bf3 100644 --- a/src/algorithms/sorting/heap-sort/README.pt-BR.md +++ b/src/algorithms/sorting/heap-sort/README.pt-BR.md @@ -2,7 +2,7 @@ _Leia isso em outros idiomas:_ [_English_](README.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Heapsort é um algoritmo de ordenação baseado em comparação. O Heapsort pode ser pensado como uma seleção aprimorada sort: como esse algoritmo, ele divide sua entrada em uma região classificada e uma região não classificada, e iterativamente encolhe a região não classificada extraindo o maior elemento e movendo-o para a região classificada. A melhoria consiste no uso de uma estrutura de dados heap em vez de uma busca em tempo linear para encontrar o máximo. diff --git a/src/algorithms/sorting/heap-sort/README.tel-IN.md b/src/algorithms/sorting/heap-sort/README.te-IN.md similarity index 100% rename from src/algorithms/sorting/heap-sort/README.tel-IN.md rename to src/algorithms/sorting/heap-sort/README.te-IN.md diff --git a/src/algorithms/sorting/insertion-sort/README.md b/src/algorithms/sorting/insertion-sort/README.md index f25691e183..c8288dc358 100644 --- a/src/algorithms/sorting/insertion-sort/README.md +++ b/src/algorithms/sorting/insertion-sort/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. diff --git a/src/algorithms/sorting/insertion-sort/README.pt-BR.md b/src/algorithms/sorting/insertion-sort/README.pt-BR.md index c5c0e368d2..ec105ad933 100644 --- a/src/algorithms/sorting/insertion-sort/README.pt-BR.md +++ b/src/algorithms/sorting/insertion-sort/README.pt-BR.md @@ -2,7 +2,7 @@ _Leia isso em outros idiomas:_ [_English_](README.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) A ordenação por inserção é um algoritmo de ordenação simples que cria a matriz classificada final (ou lista) um item de cada vez. É muito menos eficiente em grandes listas do que mais algoritmos avançados, como quicksort, heapsort ou merge diff --git a/src/algorithms/sorting/insertion-sort/README.tel-IN.md b/src/algorithms/sorting/insertion-sort/README.te-IN.md similarity index 100% rename from src/algorithms/sorting/insertion-sort/README.tel-IN.md rename to src/algorithms/sorting/insertion-sort/README.te-IN.md diff --git a/src/algorithms/sorting/merge-sort/README.md b/src/algorithms/sorting/merge-sort/README.md index bff32e7602..a49bbb0654 100644 --- a/src/algorithms/sorting/merge-sort/README.md +++ b/src/algorithms/sorting/merge-sort/README.md @@ -3,7 +3,7 @@ _Read this in other languages:_ [_한국어_](README.ko-KR.md), [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In computer science, merge sort (also commonly spelled mergesort) is an efficient, general-purpose, diff --git a/src/algorithms/sorting/merge-sort/README.pt-BR.md b/src/algorithms/sorting/merge-sort/README.pt-BR.md index f8d81a8c3f..6c88ca1734 100644 --- a/src/algorithms/sorting/merge-sort/README.pt-BR.md +++ b/src/algorithms/sorting/merge-sort/README.pt-BR.md @@ -3,7 +3,7 @@ _Leia isso em outros idiomas:_ [_한국어_](README.ko-KR.md), [_English_](README.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Em ciência da computação, merge sort (também comumente escrito mergesort) é uma ferramenta eficiente, de propósito geral, diff --git a/src/algorithms/sorting/merge-sort/README.tel-IN.md b/src/algorithms/sorting/merge-sort/README.te-IN.md similarity index 100% rename from src/algorithms/sorting/merge-sort/README.tel-IN.md rename to src/algorithms/sorting/merge-sort/README.te-IN.md diff --git a/src/algorithms/sorting/quick-sort/README.md b/src/algorithms/sorting/quick-sort/README.md index e03c3e233f..be7e70ee1c 100644 --- a/src/algorithms/sorting/quick-sort/README.md +++ b/src/algorithms/sorting/quick-sort/README.md @@ -3,7 +3,7 @@ _Read this in other languages:_ [_简体中文_](README.zh-CN.md), [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Quicksort is a divide and conquer algorithm. Quicksort first divides a large array into two smaller diff --git a/src/algorithms/sorting/quick-sort/README.pt-BR.md b/src/algorithms/sorting/quick-sort/README.pt-BR.md index 18f3982d6c..af7814400b 100644 --- a/src/algorithms/sorting/quick-sort/README.pt-BR.md +++ b/src/algorithms/sorting/quick-sort/README.pt-BR.md @@ -3,7 +3,7 @@ _Leia isso em outros idiomas:_ [_简体中文_](README.zh-CN.md), [_English_](README.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Quicksort é um algoritmo de dividir para conquistar. Quicksort primeiro divide uma grande matriz em duas menores diff --git a/src/algorithms/sorting/quick-sort/README.tel-IN.md b/src/algorithms/sorting/quick-sort/README.te-IN.md similarity index 100% rename from src/algorithms/sorting/quick-sort/README.tel-IN.md rename to src/algorithms/sorting/quick-sort/README.te-IN.md diff --git a/src/algorithms/sorting/radix-sort/README.md b/src/algorithms/sorting/radix-sort/README.md index 2768c3b4c5..0f69f58f7c 100644 --- a/src/algorithms/sorting/radix-sort/README.md +++ b/src/algorithms/sorting/radix-sort/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In computer science, **radix sort** is a non-comparative integer sorting algorithm that sorts data with integer keys by grouping keys by the individual diff --git a/src/algorithms/sorting/radix-sort/README.pt-BR.md b/src/algorithms/sorting/radix-sort/README.pt-BR.md index 7e54f93774..81431e2d11 100644 --- a/src/algorithms/sorting/radix-sort/README.pt-BR.md +++ b/src/algorithms/sorting/radix-sort/README.pt-BR.md @@ -2,7 +2,7 @@ _Leia isso em outros idiomas:_ [_English_](README.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Em ciência da computação, **radix sort** é uma classificação inteira não comparativa algoritmo que classifica os dados com chaves inteiras agrupando as chaves pelo indivíduo diff --git a/src/algorithms/sorting/radix-sort/README.tel-IN.md b/src/algorithms/sorting/radix-sort/README.te-IN.md similarity index 100% rename from src/algorithms/sorting/radix-sort/README.tel-IN.md rename to src/algorithms/sorting/radix-sort/README.te-IN.md diff --git a/src/algorithms/sorting/selection-sort/README.md b/src/algorithms/sorting/selection-sort/README.md index b358909e4d..eb18135b2d 100644 --- a/src/algorithms/sorting/selection-sort/README.md +++ b/src/algorithms/sorting/selection-sort/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). Selection sort is a sorting algorithm, specifically an in-place comparison sort. It has O(n2) time complexity, diff --git a/src/algorithms/sorting/selection-sort/README.pt-BR.md b/src/algorithms/sorting/selection-sort/README.pt-BR.md index 13bd92b59c..1a0f592252 100644 --- a/src/algorithms/sorting/selection-sort/README.pt-BR.md +++ b/src/algorithms/sorting/selection-sort/README.pt-BR.md @@ -2,7 +2,7 @@ _Leia isso em outros idiomas:_ [_English_](README.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). Selection Sort é um algoritmo de ordenação, mais especificamente um algoritmo de ordenação por comparação in-place (requer uma quantidade constante de espaço de memória adicional). Tem complexidade O(n²), tornando-o ineficiente em listas grandes e, geralmente, tem desempenho inferior ao similar Insertion Sort. O Selection Sort é conhecido por sua simplicidade e tem vantagens de desempenho sobre algoritmos mais complexos em certas situações, particularmente quando a memória auxiliar é limitada. diff --git a/src/algorithms/sorting/selection-sort/README.tel-IN.md b/src/algorithms/sorting/selection-sort/README.te-IN.md similarity index 100% rename from src/algorithms/sorting/selection-sort/README.tel-IN.md rename to src/algorithms/sorting/selection-sort/README.te-IN.md diff --git a/src/algorithms/sorting/shell-sort/README.md b/src/algorithms/sorting/shell-sort/README.md index 8369af4634..679eb3a3ed 100644 --- a/src/algorithms/sorting/shell-sort/README.md +++ b/src/algorithms/sorting/shell-sort/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). Shellsort, also known as Shell sort or Shell's method, is an in-place comparison sort. It can be seen as either a diff --git a/src/algorithms/sorting/shell-sort/README.pt-BR.md b/src/algorithms/sorting/shell-sort/README.pt-BR.md index 97e1be7e9d..4cafc41838 100644 --- a/src/algorithms/sorting/shell-sort/README.pt-BR.md +++ b/src/algorithms/sorting/shell-sort/README.pt-BR.md @@ -2,7 +2,7 @@ _Leia isso em outros idiomas:_ [_English_](README.md), -[_తెలుగు_](README.tel-IN.md). +[_తెలుగు_](README.te-IN.md). Shellsort, também conhecido como Shell sort ou método de Shell, é uma classificação de comparação in-loco. Pode ser visto tanto como um diff --git a/src/algorithms/sorting/shell-sort/README.tel-IN.md b/src/algorithms/sorting/shell-sort/README.te-IN.md similarity index 100% rename from src/algorithms/sorting/shell-sort/README.tel-IN.md rename to src/algorithms/sorting/shell-sort/README.te-IN.md diff --git a/src/algorithms/stack/valid-parentheses/README.md b/src/algorithms/stack/valid-parentheses/README.md index 6e1494ca75..cd43f7eadd 100644 --- a/src/algorithms/stack/valid-parentheses/README.md +++ b/src/algorithms/stack/valid-parentheses/README.md @@ -1,7 +1,7 @@ # Valid Parentheses Problem _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. diff --git a/src/algorithms/stack/valid-parentheses/README.tel-IN.md b/src/algorithms/stack/valid-parentheses/README.te-IN.md similarity index 100% rename from src/algorithms/stack/valid-parentheses/README.tel-IN.md rename to src/algorithms/stack/valid-parentheses/README.te-IN.md diff --git a/src/algorithms/statistics/weighted-random/README.md b/src/algorithms/statistics/weighted-random/README.md index faf9ce01d7..821cdb9c7f 100644 --- a/src/algorithms/statistics/weighted-random/README.md +++ b/src/algorithms/statistics/weighted-random/README.md @@ -1,7 +1,7 @@ # Weighted Random _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ![Weighted Random](images/cover.png) diff --git a/src/algorithms/statistics/weighted-random/README.tel-IN.md b/src/algorithms/statistics/weighted-random/README.te-IN.md similarity index 100% rename from src/algorithms/statistics/weighted-random/README.tel-IN.md rename to src/algorithms/statistics/weighted-random/README.te-IN.md diff --git a/src/algorithms/string/hamming-distance/README.md b/src/algorithms/string/hamming-distance/README.md index ba7e919788..219d61b00d 100644 --- a/src/algorithms/string/hamming-distance/README.md +++ b/src/algorithms/string/hamming-distance/README.md @@ -1,7 +1,7 @@ # Hamming Distance _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) the Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are diff --git a/src/algorithms/string/hamming-distance/README.tel-IN.md b/src/algorithms/string/hamming-distance/README.te-IN.md similarity index 100% rename from src/algorithms/string/hamming-distance/README.tel-IN.md rename to src/algorithms/string/hamming-distance/README.te-IN.md diff --git a/src/algorithms/string/knuth-morris-pratt/README.md b/src/algorithms/string/knuth-morris-pratt/README.md index b27c677dec..a9c0d7b0f5 100644 --- a/src/algorithms/string/knuth-morris-pratt/README.md +++ b/src/algorithms/string/knuth-morris-pratt/README.md @@ -1,7 +1,7 @@ # Knuth–Morris–Pratt Algorithm _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The Knuth–Morris–Pratt string searching algorithm (or KMP algorithm) searches for occurrences of a "word" `W` diff --git a/src/algorithms/string/knuth-morris-pratt/README.tel-IN.md b/src/algorithms/string/knuth-morris-pratt/README.te-IN.md similarity index 100% rename from src/algorithms/string/knuth-morris-pratt/README.tel-IN.md rename to src/algorithms/string/knuth-morris-pratt/README.te-IN.md diff --git a/src/algorithms/string/levenshtein-distance/README.md b/src/algorithms/string/levenshtein-distance/README.md index 2c44f3bae0..12cc0f9894 100644 --- a/src/algorithms/string/levenshtein-distance/README.md +++ b/src/algorithms/string/levenshtein-distance/README.md @@ -1,7 +1,7 @@ # Levenshtein Distance _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The Levenshtein distance is a string metric for measuring the difference between two sequences. Informally, the Levenshtein diff --git a/src/algorithms/string/levenshtein-distance/README.tel-IN.md b/src/algorithms/string/levenshtein-distance/README.te-IN.md similarity index 100% rename from src/algorithms/string/levenshtein-distance/README.tel-IN.md rename to src/algorithms/string/levenshtein-distance/README.te-IN.md diff --git a/src/algorithms/string/longest-common-substring/README.md b/src/algorithms/string/longest-common-substring/README.md index 96d6fce147..f595001e3c 100644 --- a/src/algorithms/string/longest-common-substring/README.md +++ b/src/algorithms/string/longest-common-substring/README.md @@ -1,7 +1,7 @@ # Longest Common Substring Problem _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The longest common substring problem is to find the longest string (or strings) that is a substring (or are substrings) of two or more diff --git a/src/algorithms/string/longest-common-substring/README.tel-IN.md b/src/algorithms/string/longest-common-substring/README.te-IN.md similarity index 100% rename from src/algorithms/string/longest-common-substring/README.tel-IN.md rename to src/algorithms/string/longest-common-substring/README.te-IN.md diff --git a/src/algorithms/string/palindrome/README.md b/src/algorithms/string/palindrome/README.md index f384e4df18..365be55d32 100644 --- a/src/algorithms/string/palindrome/README.md +++ b/src/algorithms/string/palindrome/README.md @@ -1,7 +1,7 @@ # Palindrome Check _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) A [Palindrome](https://en.wikipedia.org/wiki/Palindrome) is a string that reads the same forwards and backwards. This means that the second half of the string is the reverse of the diff --git a/src/algorithms/string/palindrome/README.tel-IN.md b/src/algorithms/string/palindrome/README.te-IN.md similarity index 100% rename from src/algorithms/string/palindrome/README.tel-IN.md rename to src/algorithms/string/palindrome/README.te-IN.md diff --git a/src/algorithms/string/rabin-karp/README.md b/src/algorithms/string/rabin-karp/README.md index bd7715364a..ecf60cfee8 100644 --- a/src/algorithms/string/rabin-karp/README.md +++ b/src/algorithms/string/rabin-karp/README.md @@ -1,7 +1,7 @@ # Rabin Karp Algorithm _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In computer science, the Rabin–Karp algorithm or Karp–Rabin algorithm is a string searching algorithm created by Richard M. Karp and diff --git a/src/algorithms/string/rabin-karp/README.tel-IN.md b/src/algorithms/string/rabin-karp/README.te-IN.md similarity index 100% rename from src/algorithms/string/rabin-karp/README.tel-IN.md rename to src/algorithms/string/rabin-karp/README.te-IN.md diff --git a/src/algorithms/string/regular-expression-matching/README.md b/src/algorithms/string/regular-expression-matching/README.md index b8084019c6..cb71ccc2ef 100644 --- a/src/algorithms/string/regular-expression-matching/README.md +++ b/src/algorithms/string/regular-expression-matching/README.md @@ -1,7 +1,7 @@ # Regular Expression Matching _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Given an input string `s` and a pattern `p`, implement regular expression matching with support for `.` and `*`. diff --git a/src/algorithms/string/regular-expression-matching/README.tel-IN.md b/src/algorithms/string/regular-expression-matching/README.te-IN.md similarity index 100% rename from src/algorithms/string/regular-expression-matching/README.tel-IN.md rename to src/algorithms/string/regular-expression-matching/README.te-IN.md diff --git a/src/algorithms/string/z-algorithm/README.md b/src/algorithms/string/z-algorithm/README.md index eb5c0bf0f0..8c9a893538 100644 --- a/src/algorithms/string/z-algorithm/README.md +++ b/src/algorithms/string/z-algorithm/README.md @@ -1,7 +1,7 @@ # Z Algorithm _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The Z-algorithm finds occurrences of a "word" `W` within a main "text string" `T` in linear time `O(|W| + |T|)`. diff --git a/src/algorithms/string/z-algorithm/README.tel-IN.md b/src/algorithms/string/z-algorithm/README.te-IN.md similarity index 100% rename from src/algorithms/string/z-algorithm/README.tel-IN.md rename to src/algorithms/string/z-algorithm/README.te-IN.md diff --git a/src/algorithms/tree/breadth-first-search/README.md b/src/algorithms/tree/breadth-first-search/README.md index 6cd1b6ab2d..c707f2f91e 100644 --- a/src/algorithms/tree/breadth-first-search/README.md +++ b/src/algorithms/tree/breadth-first-search/README.md @@ -1,7 +1,7 @@ # Breadth-First Search (BFS) _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Breadth-first search (BFS) is an algorithm for traversing or searching tree or graph data structures. It starts at diff --git a/src/algorithms/tree/breadth-first-search/README.tel-IN.md b/src/algorithms/tree/breadth-first-search/README.te-IN.md similarity index 100% rename from src/algorithms/tree/breadth-first-search/README.tel-IN.md rename to src/algorithms/tree/breadth-first-search/README.te-IN.md diff --git a/src/algorithms/tree/depth-first-search/README.md b/src/algorithms/tree/depth-first-search/README.md index 4c153c19d1..3c38c06f86 100644 --- a/src/algorithms/tree/depth-first-search/README.md +++ b/src/algorithms/tree/depth-first-search/README.md @@ -1,7 +1,7 @@ # Depth-First Search (DFS) _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. One starts at diff --git a/src/algorithms/tree/depth-first-search/README.tel-IN.md b/src/algorithms/tree/depth-first-search/README.te-IN.md similarity index 100% rename from src/algorithms/tree/depth-first-search/README.tel-IN.md rename to src/algorithms/tree/depth-first-search/README.te-IN.md diff --git a/src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.md b/src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.md index 1b51f827aa..563e616f16 100644 --- a/src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.md +++ b/src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.md @@ -1,7 +1,7 @@ # Best Time to Buy and Sell Stock _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## Task Description diff --git a/src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.tel-IN.md b/src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.te-IN.md similarity index 100% rename from src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.tel-IN.md rename to src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.te-IN.md diff --git a/src/algorithms/uncategorized/hanoi-tower/README.md b/src/algorithms/uncategorized/hanoi-tower/README.md index 77e6be529d..858a6b9f2c 100644 --- a/src/algorithms/uncategorized/hanoi-tower/README.md +++ b/src/algorithms/uncategorized/hanoi-tower/README.md @@ -1,7 +1,7 @@ # Tower of Hanoi _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The Tower of Hanoi (also called the Tower of Brahma or Lucas' Tower and sometimes pluralized) is a mathematical game or puzzle. diff --git a/src/algorithms/uncategorized/hanoi-tower/README.tel-IN.md b/src/algorithms/uncategorized/hanoi-tower/README.te-IN.md similarity index 100% rename from src/algorithms/uncategorized/hanoi-tower/README.tel-IN.md rename to src/algorithms/uncategorized/hanoi-tower/README.te-IN.md diff --git a/src/algorithms/uncategorized/jump-game/README.md b/src/algorithms/uncategorized/jump-game/README.md index 1abfc83936..f921429964 100644 --- a/src/algorithms/uncategorized/jump-game/README.md +++ b/src/algorithms/uncategorized/jump-game/README.md @@ -1,7 +1,7 @@ # Jump Game _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## The Problem diff --git a/src/algorithms/uncategorized/jump-game/README.tel-IN.md b/src/algorithms/uncategorized/jump-game/README.te-IN.md similarity index 100% rename from src/algorithms/uncategorized/jump-game/README.tel-IN.md rename to src/algorithms/uncategorized/jump-game/README.te-IN.md diff --git a/src/algorithms/uncategorized/knight-tour/README.md b/src/algorithms/uncategorized/knight-tour/README.md index 1ab0738744..995447ccfb 100644 --- a/src/algorithms/uncategorized/knight-tour/README.md +++ b/src/algorithms/uncategorized/knight-tour/README.md @@ -1,7 +1,7 @@ # Knight's Tour _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) A **knight's tour** is a sequence of moves of a knight on a chessboard such that the knight visits every square only once. If the knight diff --git a/src/algorithms/uncategorized/knight-tour/README.tel-IN.md b/src/algorithms/uncategorized/knight-tour/README.te-IN.md similarity index 100% rename from src/algorithms/uncategorized/knight-tour/README.tel-IN.md rename to src/algorithms/uncategorized/knight-tour/README.te-IN.md diff --git a/src/algorithms/uncategorized/n-queens/README.md b/src/algorithms/uncategorized/n-queens/README.md index 6753f60d11..9b08c5641b 100644 --- a/src/algorithms/uncategorized/n-queens/README.md +++ b/src/algorithms/uncategorized/n-queens/README.md @@ -1,7 +1,7 @@ # N-Queens Problem _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) The **eight queens puzzle** is the problem of placing eight chess queens on an `8×8` chessboard so that no two queens threaten each other. diff --git a/src/algorithms/uncategorized/n-queens/README.tel-IN.md b/src/algorithms/uncategorized/n-queens/README.te-IN.md similarity index 100% rename from src/algorithms/uncategorized/n-queens/README.tel-IN.md rename to src/algorithms/uncategorized/n-queens/README.te-IN.md diff --git a/src/algorithms/uncategorized/rain-terraces/README.md b/src/algorithms/uncategorized/rain-terraces/README.md index a302fd4f0f..822a6221bb 100644 --- a/src/algorithms/uncategorized/rain-terraces/README.md +++ b/src/algorithms/uncategorized/rain-terraces/README.md @@ -1,7 +1,7 @@ # Rain Terraces (Trapping Rain Water) Problem _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Given an array of non-negative integers representing terraces in an elevation map where the width of each bar is `1`, compute how much water it is able to trap diff --git a/src/algorithms/uncategorized/rain-terraces/README.tel-IN.md b/src/algorithms/uncategorized/rain-terraces/README.te-IN.md similarity index 100% rename from src/algorithms/uncategorized/rain-terraces/README.tel-IN.md rename to src/algorithms/uncategorized/rain-terraces/README.te-IN.md diff --git a/src/algorithms/uncategorized/recursive-staircase/README.md b/src/algorithms/uncategorized/recursive-staircase/README.md index fc632595b4..e2dbaa1fa8 100644 --- a/src/algorithms/uncategorized/recursive-staircase/README.md +++ b/src/algorithms/uncategorized/recursive-staircase/README.md @@ -1,7 +1,7 @@ # Recursive Staircase Problem _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## The Problem diff --git a/src/algorithms/uncategorized/recursive-staircase/README.tel-IN.md b/src/algorithms/uncategorized/recursive-staircase/README.te-IN.md similarity index 100% rename from src/algorithms/uncategorized/recursive-staircase/README.tel-IN.md rename to src/algorithms/uncategorized/recursive-staircase/README.te-IN.md diff --git a/src/algorithms/uncategorized/square-matrix-rotation/README.md b/src/algorithms/uncategorized/square-matrix-rotation/README.md index 5adfa2b0ac..d9e6ec557f 100644 --- a/src/algorithms/uncategorized/square-matrix-rotation/README.md +++ b/src/algorithms/uncategorized/square-matrix-rotation/README.md @@ -1,7 +1,7 @@ # Square Matrix In-Place Rotation _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) ## The Problem diff --git a/src/algorithms/uncategorized/square-matrix-rotation/README.tel-IN.md b/src/algorithms/uncategorized/square-matrix-rotation/README.te-IN.md similarity index 100% rename from src/algorithms/uncategorized/square-matrix-rotation/README.tel-IN.md rename to src/algorithms/uncategorized/square-matrix-rotation/README.te-IN.md diff --git a/src/algorithms/uncategorized/unique-paths/README.md b/src/algorithms/uncategorized/unique-paths/README.md index 310a84be47..71f2bbe005 100644 --- a/src/algorithms/uncategorized/unique-paths/README.md +++ b/src/algorithms/uncategorized/unique-paths/README.md @@ -1,7 +1,7 @@ # Unique Paths Problem _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) A robot is located at the top-left corner of a `m x n` grid (marked 'Start' in the diagram below). diff --git a/src/algorithms/uncategorized/unique-paths/README.tel-IN.md b/src/algorithms/uncategorized/unique-paths/README.te-IN.md similarity index 100% rename from src/algorithms/uncategorized/unique-paths/README.tel-IN.md rename to src/algorithms/uncategorized/unique-paths/README.te-IN.md diff --git a/src/data-structures/bloom-filter/README.md b/src/data-structures/bloom-filter/README.md index be62f1b4a6..bb442256e8 100644 --- a/src/data-structures/bloom-filter/README.md +++ b/src/data-structures/bloom-filter/README.md @@ -4,7 +4,7 @@ _Read this in other languages:_ [_Русский_](README.ru-RU.md), [_Português_](README.pt-BR.md), [_Українська_](README.uk-UA.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) A **bloom filter** is a space-efficient probabilistic data structure designed to test whether an element diff --git a/src/data-structures/bloom-filter/README.tel-IN.md b/src/data-structures/bloom-filter/README.te-IN.md similarity index 100% rename from src/data-structures/bloom-filter/README.tel-IN.md rename to src/data-structures/bloom-filter/README.te-IN.md diff --git a/src/data-structures/deque/README.md b/src/data-structures/deque/README.md index 0ba4b8262f..7689edce30 100644 --- a/src/data-structures/deque/README.md +++ b/src/data-structures/deque/README.md @@ -1,7 +1,7 @@ # Deque (Double-Ended Queue) _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) A **deque** (pronounced "deck", short for **double-ended queue**) is a linear data structure that generalizes both a stack and a queue. Elements can be added or diff --git a/src/data-structures/deque/README.tel-IN.md b/src/data-structures/deque/README.te-IN.md similarity index 100% rename from src/data-structures/deque/README.tel-IN.md rename to src/data-structures/deque/README.te-IN.md diff --git a/src/data-structures/disjoint-set/README.md b/src/data-structures/disjoint-set/README.md index 316f47f43d..ada32e7ebe 100644 --- a/src/data-structures/disjoint-set/README.md +++ b/src/data-structures/disjoint-set/README.md @@ -4,7 +4,7 @@ _Read this in other languages:_ [_Русский_](README.ru-RU.md), [_Português_](README.pt-BR.md), [_Українська_](README.uk-UA.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.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. diff --git a/src/data-structures/disjoint-set/README.tel-IN.md b/src/data-structures/disjoint-set/README.te-IN.md similarity index 100% rename from src/data-structures/disjoint-set/README.tel-IN.md rename to src/data-structures/disjoint-set/README.te-IN.md diff --git a/src/data-structures/doubly-linked-list/README.es-ES.md b/src/data-structures/doubly-linked-list/README.es-ES.md index c1193fa0ff..e36826b4ba 100644 --- a/src/data-structures/doubly-linked-list/README.es-ES.md +++ b/src/data-structures/doubly-linked-list/README.es-ES.md @@ -6,7 +6,7 @@ _Lea esto en otros idiomas:_ [_日本語_](README.ja-JP.md), [_Português_](README.pt-BR.md) [_한국어_](README.ko-KR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) En informática, una **lista doblemente enlazada** es una estructura de datos relacionados que consta de un conjunto de registros conectados secuencialmente llamados nodos. Cada nodo contiene dos campos, llamados enlaces, que son referencias al nodo anterior y al siguiente en la secuencia de nodos. Los enlaces anterior y siguiente de los nodos inicial y final, apuntan respectivamente a algún tipo de terminador (normalmente un nodo centinela o nulo), facilitando así el recorrido de la lista. Si solo hay un nodo nulo, la lista se enlaza circularmente a través este. Puede conceptualizarse como dos listas enlazadas individualmente formadas a partir de los mismos elementos de datos, pero en órdenes secuenciales opuestos. diff --git a/src/data-structures/doubly-linked-list/README.ko-KR.md b/src/data-structures/doubly-linked-list/README.ko-KR.md index 632469ef4a..14dce6ff31 100644 --- a/src/data-structures/doubly-linked-list/README.ko-KR.md +++ b/src/data-structures/doubly-linked-list/README.ko-KR.md @@ -5,7 +5,7 @@ _Read this in other languages:_ [_简体中文_](README.zh-CN.md), [_日本語_](README.ja-JP.md), [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) 컴퓨터공학에서 **이중 연결 리스트**는 순차적으로 링크된 노드라는 레코드 세트로 구성된 링크된 데이터 구조입니다. 각 노드에는 링크라고 하는 두 개의 필드가 있으며, 노드 순서에서 이전 노드와 다음 노드에 대한 참조를 가집니다. diff --git a/src/data-structures/doubly-linked-list/README.md b/src/data-structures/doubly-linked-list/README.md index 92d03fe6d7..c0b7db09b0 100644 --- a/src/data-structures/doubly-linked-list/README.md +++ b/src/data-structures/doubly-linked-list/README.md @@ -8,7 +8,7 @@ _Read this in other languages:_ [_한국어_](README.ko-KR.md), [_Español_](README.es-ES.md), [_Українська_](README.uk-UA.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.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 diff --git a/src/data-structures/doubly-linked-list/README.tel-IN.md b/src/data-structures/doubly-linked-list/README.te-IN.md similarity index 100% rename from src/data-structures/doubly-linked-list/README.tel-IN.md rename to src/data-structures/doubly-linked-list/README.te-IN.md diff --git a/src/data-structures/graph/README.md b/src/data-structures/graph/README.md index 52c17247af..14c2848f3b 100644 --- a/src/data-structures/graph/README.md +++ b/src/data-structures/graph/README.md @@ -6,7 +6,7 @@ _Read this in other languages:_ [_Français_](README.fr-FR.md), [_Português_](README.pt-BR.md), [_Українська_](README.uk-UA.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In computer science, a **graph** is an abstract data type diff --git a/src/data-structures/graph/README.tel-IN.md b/src/data-structures/graph/README.te-IN.md similarity index 100% rename from src/data-structures/graph/README.tel-IN.md rename to src/data-structures/graph/README.te-IN.md diff --git a/src/data-structures/hash-table/README.ko-KR.md b/src/data-structures/hash-table/README.ko-KR.md index cdd2459372..63a0adab2d 100644 --- a/src/data-structures/hash-table/README.ko-KR.md +++ b/src/data-structures/hash-table/README.ko-KR.md @@ -6,7 +6,7 @@ _Read this in other languages:_ [_日本語_](README.ja-JP.md), [_Français_](README.fr-FR.md), [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) 컴퓨팅에서, **해시 테이블**(해시 맵)은 키를 값에 매핑할 수 있는 구조인 *연관 배열*을 구현하는 자료 구조입니다. 해시 테이블은 *해시 함수*를 사용해 원하는 값을 담을 수 있는 버킷 또는 슬롯 배열의 인덱스를 계산합니다. diff --git a/src/data-structures/hash-table/README.md b/src/data-structures/hash-table/README.md index c387ee7006..9a89ea79c9 100644 --- a/src/data-structures/hash-table/README.md +++ b/src/data-structures/hash-table/README.md @@ -8,7 +8,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), [_한국어_](README.ko-KR.md), [_Українська_](README.uk-UA.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In computing, a **hash table** (hash map) is a data structure which implements an _associative array_ diff --git a/src/data-structures/hash-table/README.tel-IN.md b/src/data-structures/hash-table/README.te-IN.md similarity index 100% rename from src/data-structures/hash-table/README.tel-IN.md rename to src/data-structures/hash-table/README.te-IN.md diff --git a/src/data-structures/heap/README.md b/src/data-structures/heap/README.md index a9509145f3..605e97382e 100644 --- a/src/data-structures/heap/README.md +++ b/src/data-structures/heap/README.md @@ -9,7 +9,7 @@ _Read this in other languages:_ [_Türkçe_](README.tr-TR.md), [_한국어_](README.ko-KR.md), [_Українська_](README.uk-UA.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In computer science, a **heap** is a specialized tree-based diff --git a/src/data-structures/heap/README.tel-IN.md b/src/data-structures/heap/README.te-IN.md similarity index 100% rename from src/data-structures/heap/README.tel-IN.md rename to src/data-structures/heap/README.te-IN.md diff --git a/src/data-structures/linked-list/README.es-ES.md b/src/data-structures/linked-list/README.es-ES.md index 49c6cb2440..820a81e7d0 100644 --- a/src/data-structures/linked-list/README.es-ES.md +++ b/src/data-structures/linked-list/README.es-ES.md @@ -6,7 +6,7 @@ _Lee este artículo en otros idiomas:_ [_日本語_](README.ja-JP.md), [_Português_](README.pt-BR.md) [_English_](README.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) En ciencias de la computación una **lista enlazada** es una colección lineal de elementos, en los cuales el orden lineal no es dado por diff --git a/src/data-structures/linked-list/README.ko-KR.md b/src/data-structures/linked-list/README.ko-KR.md index 4156eca54e..aecba8085b 100644 --- a/src/data-structures/linked-list/README.ko-KR.md +++ b/src/data-structures/linked-list/README.ko-KR.md @@ -5,7 +5,7 @@ _Read this in other languages:_ [_Русский_](README.ru-RU.md), [_日本語_](README.ja-JP.md), [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) 컴퓨터과학에서, **링크드 리스트**는 데이터 요소의 선형 집합이며, 이 집합에서 논리적 저장 순서는 메모리의 물리적 저장 순서와 일치하지 않습니다. 그 대신, 각각의 원소들은 자기 자신 다음의 원소를 가리킵니다. **링크드 리스트**는 순서를 표현하는 노드들의 집합으로 이루어져 있습니다. 간단하게, 각각의 노드들은 데이터와 다음 순서의 노드를 가리키는 레퍼런스로 이루어져 있습니다. (링크라고 부릅니다.) 이 자료구조는 순회하는 동안 순서에 상관없이 효율적인 삽입이나 삭제가 가능합니다. 더 복잡한 변형은 추가적인 링크를 더해, 임의의 원소 참조로부터 효율적인 삽입과 삭제를 가능하게 합니다. 링크드 리스트의 단점은 접근 시간이 선형이라는 것이고, 병렬처리도 하지 못합니다. 임의 접근처럼 빠른 접근은 불가능합니다. 링크드 리스트에 비해 배열이 더 나은 캐시 지역성을 가지고 있습니다. diff --git a/src/data-structures/linked-list/README.md b/src/data-structures/linked-list/README.md index 8555e92797..16aa31ec23 100644 --- a/src/data-structures/linked-list/README.md +++ b/src/data-structures/linked-list/README.md @@ -9,7 +9,7 @@ _Read this in other languages:_ [_Español_](README.es-ES.md), [_Türkçe_](README.tr-TR.md), [_Українська_](README.uk-UA.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In computer science, a **linked list** is a linear collection of data elements, in which linear order is not given by diff --git a/src/data-structures/linked-list/README.tel-IN.md b/src/data-structures/linked-list/README.te-IN.md similarity index 100% rename from src/data-structures/linked-list/README.tel-IN.md rename to src/data-structures/linked-list/README.te-IN.md diff --git a/src/data-structures/linked-list/README.tr-TR.md b/src/data-structures/linked-list/README.tr-TR.md index d64def3195..e32a6e2dea 100644 --- a/src/data-structures/linked-list/README.tr-TR.md +++ b/src/data-structures/linked-list/README.tr-TR.md @@ -7,7 +7,7 @@ _Bunu diğer dillerde okuyun:_ [_Português_](README.pt-BR.md), [_한국어_](README.ko-KR.md), [_Español_](README.es-ES.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Bilgisayar bilimlerinde, **Bağlantılı liste**, her biri hem gerçek verileri hem de listedeki bir sonraki düğümün bir bağlantısını içeren dinamik bir diff --git a/src/data-structures/linked-list/README.vi-VN.md b/src/data-structures/linked-list/README.vi-VN.md index fc6443b2ac..8c21fb3f74 100644 --- a/src/data-structures/linked-list/README.vi-VN.md +++ b/src/data-structures/linked-list/README.vi-VN.md @@ -9,7 +9,7 @@ _Đọc bằng ngôn ngữ khác:_ [_Español_](README.es-ES.md), [_Türkçe_](README.tr-TR.md), [_Українська_](README.uk-UA.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Trong khoa học máy tính, một danh sách liên kết là một bộ sưu tập tuyến tính diff --git a/src/data-structures/lru-cache/README.md b/src/data-structures/lru-cache/README.md index bf2290cae2..5b0775b300 100644 --- a/src/data-structures/lru-cache/README.md +++ b/src/data-structures/lru-cache/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [한국어](README.ko-KR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.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. diff --git a/src/data-structures/lru-cache/README.tel-IN.md b/src/data-structures/lru-cache/README.te-IN.md similarity index 100% rename from src/data-structures/lru-cache/README.tel-IN.md rename to src/data-structures/lru-cache/README.te-IN.md diff --git a/src/data-structures/priority-queue/README.md b/src/data-structures/priority-queue/README.md index 9043c7cee1..5e265103e8 100644 --- a/src/data-structures/priority-queue/README.md +++ b/src/data-structures/priority-queue/README.md @@ -8,7 +8,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), [_한국어_](README.ko-KR.md), [_Українська_](README.uk-UA.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In computer science, a **priority queue** is an abstract data type which is like a regular queue or stack data structure, but where diff --git a/src/data-structures/priority-queue/README.tel-IN.md b/src/data-structures/priority-queue/README.te-IN.md similarity index 100% rename from src/data-structures/priority-queue/README.tel-IN.md rename to src/data-structures/priority-queue/README.te-IN.md diff --git a/src/data-structures/queue/README.ko-KR.md b/src/data-structures/queue/README.ko-KR.md index 36d84058d5..2e15dfc4c0 100644 --- a/src/data-structures/queue/README.ko-KR.md +++ b/src/data-structures/queue/README.ko-KR.md @@ -6,7 +6,7 @@ _Read this in other languages:_ [_日本語_](README.ja-JP.md), [_Français_](README.fr-FR.md), [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) 컴퓨터 공학에서 **큐**는 일종의 추상 데이터 타입이자 컬렉션입니다. 큐 내부의 엔터티들은 순서를 유지하며 컬렉션의 가장 뒷 부분에 엔터티를 추가하는 인큐(enqueue), 컬렉션의 가장 앞에 위치한 엔터티를 제거하는 디큐(dequeue) 작업을 수행합니다. 이것은 큐를 선입선출 자료 구조로 만듭니다. 선입선출 자료 구조에서는, 추가된 첫 번째 요소가 가장 먼저 제거되는 요소가 됩니다. 이는 새로운 요소가 추가되면 이전에 추가되었던 모든 요소들을 제거해야 새로운 요소를 제거할 수 있다는것과 같은 의미입니다. 또한 큐의 가장 앞에 위치한 요소를 반환하기 위한 작업이 입력되면 디큐 작업 없이 해당 요소를 반환합니다. diff --git a/src/data-structures/queue/README.md b/src/data-structures/queue/README.md index 91fb7bb401..affae6af5a 100644 --- a/src/data-structures/queue/README.md +++ b/src/data-structures/queue/README.md @@ -8,7 +8,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), [_한국어_](README.ko-KR.md), [_Українська_](README.uk-UA.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In computer science, a **queue** is a particular kind of abstract data type or collection in which the entities in the collection are diff --git a/src/data-structures/queue/README.tel-IN.md b/src/data-structures/queue/README.te-IN.md similarity index 100% rename from src/data-structures/queue/README.tel-IN.md rename to src/data-structures/queue/README.te-IN.md diff --git a/src/data-structures/queue/README.vi-VN.md b/src/data-structures/queue/README.vi-VN.md index 325ad1fc6d..552bdc7597 100644 --- a/src/data-structures/queue/README.vi-VN.md +++ b/src/data-structures/queue/README.vi-VN.md @@ -7,7 +7,7 @@ _Đọc bằng ngôn ngữ khác:_ [_Português_](README.pt-BR.md), [_한국어_](README.ko-KR.md), [_Українська_](README.uk-UA.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Trong khoa học máy tính, một **hàng đợi** là một loại cụ thể của kiểu dữ liệu trừu tượng hoặc bộ sưu tập trong đó các phần tử trong bộ sưu tập được giữ theo thứ tự và nguyên tắc (hoặc chỉ) các hoạt động trên bộ sưu tập là thêm các phần tử vào vị trí cuối cùng, được gọi là đưa vào hàng đợi (enqueue), và loại bỏ các phần tử từ vị trí đầu tiên, được gọi là đưa ra khỏi hàng đợi (dequeue). Điều này khiến cho hàng đợi trở thành một cấu trúc dữ liệu First-In-First-Out (FIFO). Trong cấu trúc dữ liệu FIFO, phần tử đầu tiên được thêm vào hàng đợi sẽ là phần tử đầu tiên được loại bỏ. Điều này tương đương với yêu cầu rằng sau khi một phần tử mới được thêm vào, tất cả các phần tử đã được thêm vào trước đó phải được loại bỏ trước khi có thể loại bỏ phần tử mới. Thường thì cũng có thêm một hoạt động nhìn hay lấy phần đầu, trả về giá trị của phần tử đầu tiên mà không loại bỏ nó. Hàng đợi là một ví dụ về cấu trúc dữ liệu tuyến tính, hoặc trừu tượng hơn là một bộ sưu tập tuần tự. diff --git a/src/data-structures/stack/README.ko-KR.md b/src/data-structures/stack/README.ko-KR.md index 1e62640eeb..834fc45e01 100644 --- a/src/data-structures/stack/README.ko-KR.md +++ b/src/data-structures/stack/README.ko-KR.md @@ -6,7 +6,7 @@ _Read this in other languages:_ [_日本語_](README.ja-JP.md), [_Français_](README.fr-FR.md), [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) 컴퓨터 과학에서, **스택**은 아래의 두가지 연산을 가진 요소들의 집합인 추상 자료형입니다. diff --git a/src/data-structures/stack/README.md b/src/data-structures/stack/README.md index f81e8ccadb..ebc8455937 100644 --- a/src/data-structures/stack/README.md +++ b/src/data-structures/stack/README.md @@ -8,7 +8,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), [_한국어_](README.ko-KR.md), [_Українська_](README.uk-UA.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In computer science, a **stack** is an abstract data type that serves as a collection of elements, with two principal operations: diff --git a/src/data-structures/stack/README.tel-IN.md b/src/data-structures/stack/README.te-IN.md similarity index 100% rename from src/data-structures/stack/README.tel-IN.md rename to src/data-structures/stack/README.te-IN.md diff --git a/src/data-structures/stack/README.vi-VN.md b/src/data-structures/stack/README.vi-VN.md index 0f50abfc3f..97b2839964 100644 --- a/src/data-structures/stack/README.vi-VN.md +++ b/src/data-structures/stack/README.vi-VN.md @@ -8,7 +8,7 @@ _Đọc bằng ngôn ngữ khác:_ [_한국어_](README.ko-KR.md), [_Español_](README.es-ES.md), [_Українська_](README.uk-UA.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) Trong khoa học máy tính, một ngăn xếp (stack) là một kiểu dữ liệu trừu tượng phục vụ như một bộ sưu tập các phần tử, với hai hoạt động chính: diff --git a/src/data-structures/tree/README.md b/src/data-structures/tree/README.md index 7419c05c46..224a524581 100644 --- a/src/data-structures/tree/README.md +++ b/src/data-structures/tree/README.md @@ -3,7 +3,7 @@ _Read this in other languages:_ [_简体中文_](README.zh-CN.md), [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) * [Binary Search Tree](binary-search-tree) * [AVL Tree](avl-tree) diff --git a/src/data-structures/tree/README.tel-IN.md b/src/data-structures/tree/README.te-IN.md similarity index 100% rename from src/data-structures/tree/README.tel-IN.md rename to src/data-structures/tree/README.te-IN.md diff --git a/src/data-structures/tree/avl-tree/README.md b/src/data-structures/tree/avl-tree/README.md index 76464d8aed..e8c09820c2 100644 --- a/src/data-structures/tree/avl-tree/README.md +++ b/src/data-structures/tree/avl-tree/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In computer science, an **AVL tree** (named after inventors Adelson-Velsky and Landis) is a self-balancing binary search diff --git a/src/data-structures/tree/avl-tree/README.tel-IN.md b/src/data-structures/tree/avl-tree/README.te-IN.md similarity index 100% rename from src/data-structures/tree/avl-tree/README.tel-IN.md rename to src/data-structures/tree/avl-tree/README.te-IN.md diff --git a/src/data-structures/tree/binary-search-tree/README.md b/src/data-structures/tree/binary-search-tree/README.md index 1001fb50a8..506c54fef8 100644 --- a/src/data-structures/tree/binary-search-tree/README.md +++ b/src/data-structures/tree/binary-search-tree/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In computer science, **binary search trees** (BST), sometimes called ordered or sorted binary trees, are a particular type of container: diff --git a/src/data-structures/tree/binary-search-tree/README.tel-IN.md b/src/data-structures/tree/binary-search-tree/README.te-IN.md similarity index 100% rename from src/data-structures/tree/binary-search-tree/README.tel-IN.md rename to src/data-structures/tree/binary-search-tree/README.te-IN.md diff --git a/src/data-structures/tree/fenwick-tree/README.md b/src/data-structures/tree/fenwick-tree/README.md index 6fac77a34f..13751b8766 100644 --- a/src/data-structures/tree/fenwick-tree/README.md +++ b/src/data-structures/tree/fenwick-tree/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) A **Fenwick tree** or **binary indexed tree** is a data structure that can efficiently update elements and diff --git a/src/data-structures/tree/fenwick-tree/README.tel-IN.md b/src/data-structures/tree/fenwick-tree/README.te-IN.md similarity index 100% rename from src/data-structures/tree/fenwick-tree/README.tel-IN.md rename to src/data-structures/tree/fenwick-tree/README.te-IN.md diff --git a/src/data-structures/tree/red-black-tree/README.md b/src/data-structures/tree/red-black-tree/README.md index ecb49331a6..f60ac40dc2 100644 --- a/src/data-structures/tree/red-black-tree/README.md +++ b/src/data-structures/tree/red-black-tree/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) A **red–black tree** is a kind of self-balancing binary search tree in computer science. Each node of the binary tree has diff --git a/src/data-structures/tree/red-black-tree/README.tel-IN.md b/src/data-structures/tree/red-black-tree/README.te-IN.md similarity index 100% rename from src/data-structures/tree/red-black-tree/README.tel-IN.md rename to src/data-structures/tree/red-black-tree/README.te-IN.md diff --git a/src/data-structures/tree/segment-tree/README.md b/src/data-structures/tree/segment-tree/README.md index b80c126f9d..b81256e7b0 100644 --- a/src/data-structures/tree/segment-tree/README.md +++ b/src/data-structures/tree/segment-tree/README.md @@ -2,7 +2,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In computer science, a **segment tree** also known as a statistic tree is a tree data structure used for storing information about intervals, diff --git a/src/data-structures/tree/segment-tree/README.tel-IN.md b/src/data-structures/tree/segment-tree/README.te-IN.md similarity index 100% rename from src/data-structures/tree/segment-tree/README.tel-IN.md rename to src/data-structures/tree/segment-tree/README.te-IN.md diff --git a/src/data-structures/trie/README.ko-KO.md b/src/data-structures/trie/README.ko-KO.md index d6e0aff65e..ef3382e340 100644 --- a/src/data-structures/trie/README.ko-KO.md +++ b/src/data-structures/trie/README.ko-KO.md @@ -6,7 +6,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), [_Українська_](README.uk-UA.md), [_한국어_](README.ko-KO.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) 컴퓨터 과학에서 **트라이**는 디지털 트리라고도 불리며 때로는 기수 트리 또는 접두사 트리(접두사로 검색할 수 있기 때문에)라고도 불리며 일종의 검색 트리입니다. 키가 보통 문자열인 동적 집합 또는 연관 배열을 저장하는 데 사용되는 순서가 지정된 트리 데이터 구조입니다. 이진 검색 트리와 달리 트리의 어떤 노드도 해당 노드와 연결된 키를 저장하지 않으며 대신 트리의 위치가 해당 노드와 연결된 키를 정의합니다. 노드의 모든 하위 항목은 해당 노드와 연결된 문자열의 공통 접두사를 가지며 루트는 빈 문자열과 연결됩니다. 값은 모든 노드와 반드시 연결되지는 않습니다. 오히려 값은 나뭇잎과 관심 있는 키에 해당하는 일부 내부 노드에만 연결되는 경향이 있습니다. 접두사 트리의 공간에 최적화된 표현은 콤팩트 접두사 트리를 참조하십시오. diff --git a/src/data-structures/trie/README.md b/src/data-structures/trie/README.md index ff1db01ca3..5885a37fd5 100644 --- a/src/data-structures/trie/README.md +++ b/src/data-structures/trie/README.md @@ -6,7 +6,7 @@ _Read this in other languages:_ [_Português_](README.pt-BR.md), [_Українська_](README.uk-UA.md), [_한국어_](README.ko-KO.md), -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) In computer science, a **trie**, also called digital tree and sometimes radix tree or prefix tree (as they can be searched by prefixes), diff --git a/src/data-structures/trie/README.tel-IN.md b/src/data-structures/trie/README.te-IN.md similarity index 100% rename from src/data-structures/trie/README.tel-IN.md rename to src/data-structures/trie/README.te-IN.md diff --git a/src/playground/README.md b/src/playground/README.md index 0e3ff85490..28e2200c8d 100644 --- a/src/playground/README.md +++ b/src/playground/README.md @@ -1,7 +1,7 @@ # Playground _Read this in other languages:_ -[_తెలుగు_](README.tel-IN.md) +[_తెలుగు_](README.te-IN.md) You may use `playground.js` file to play with data structures and algorithms. The code from `playground.js` may diff --git a/src/playground/README.tel-IN.md b/src/playground/README.te-IN.md similarity index 100% rename from src/playground/README.tel-IN.md rename to src/playground/README.te-IN.md