From 7d13e6863a940fbc81987b32700681a513794f4a Mon Sep 17 00:00:00 2001 From: Oleksii Trekhleb Date: Sat, 22 Jan 2022 10:50:33 +0100 Subject: [PATCH] README fixes. --- src/algorithms/cryptography/caesar-cipher/README.md | 3 +++ src/algorithms/linked-list/traversal/README.md | 2 +- src/algorithms/string/knuth-morris-pratt/knuthMorrisPratt.js | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/algorithms/cryptography/caesar-cipher/README.md b/src/algorithms/cryptography/caesar-cipher/README.md index 428b5a97..d648a62e 100644 --- a/src/algorithms/cryptography/caesar-cipher/README.md +++ b/src/algorithms/cryptography/caesar-cipher/README.md @@ -1,5 +1,8 @@ # Caesar Cipher Algorithm +_Read this in other languages:_ +[_Русский_](README.ru-RU.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. ![Caesar Cipher Algorithm](https://upload.wikimedia.org/wikipedia/commons/4/4a/Caesar_cipher_left_shift_of_3.svg) diff --git a/src/algorithms/linked-list/traversal/README.md b/src/algorithms/linked-list/traversal/README.md index d1b74ea5..9acbe98d 100644 --- a/src/algorithms/linked-list/traversal/README.md +++ b/src/algorithms/linked-list/traversal/README.md @@ -1,7 +1,7 @@ # Linked List Traversal _Read this in other languages:_ -[_Русский_](README.ru-RU.md) +[_Русский_](README.ru-RU.md), [中文](README.zh-CN.md) The task is to traverse the given linked list in straight order. diff --git a/src/algorithms/string/knuth-morris-pratt/knuthMorrisPratt.js b/src/algorithms/string/knuth-morris-pratt/knuthMorrisPratt.js index 82b94904..a3a39904 100644 --- a/src/algorithms/string/knuth-morris-pratt/knuthMorrisPratt.js +++ b/src/algorithms/string/knuth-morris-pratt/knuthMorrisPratt.js @@ -43,7 +43,7 @@ export default function knuthMorrisPratt(text, word) { if (text[textIndex] === word[wordIndex]) { // We've found a match. if (wordIndex === word.length - 1) { - return textIndex - word.length + 1; + return (textIndex - word.length) + 1; } wordIndex += 1; textIndex += 1;