Rolling Hash Function Tutorial, used by Rabin-Karp String Searching Algorithm
In this tutorial we are going to discuss how to implement a "rolling hash function". We will derive a concrete implementation and show how it could be used to efficiently find a pattern string in a text. The search algorithm that makes use of it was invented by Richard M. Karp and Michael O. Rabin (1987).
The main benefit of a rolling hash function is that regardless of the length of the search pattern, we do a constant number of operations to compute the next hash value.
Making use of this property of modulo multiplication:
(A * B) mod C = ((A mod C) * (B mod C)) mod C
we show how the hash could be computed without having to deal with large numbers.
Wikipedia: https://en.wikipedia.org/wiki/Rolling_hash
Credit to Drew Binsky for footage of Afghan Hash: https://youtu.be/eHsW-xA-1Sc
Written and narrated by Andre Violentyev
Видео Rolling Hash Function Tutorial, used by Rabin-Karp String Searching Algorithm канала Stable Sort
The main benefit of a rolling hash function is that regardless of the length of the search pattern, we do a constant number of operations to compute the next hash value.
Making use of this property of modulo multiplication:
(A * B) mod C = ((A mod C) * (B mod C)) mod C
we show how the hash could be computed without having to deal with large numbers.
Wikipedia: https://en.wikipedia.org/wiki/Rolling_hash
Credit to Drew Binsky for footage of Afghan Hash: https://youtu.be/eHsW-xA-1Sc
Written and narrated by Andre Violentyev
Видео Rolling Hash Function Tutorial, used by Rabin-Karp String Searching Algorithm канала Stable Sort
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
![Knuth Morris Pratt (KMP) String Search Algorithm - tutorial with failure function in Java](https://i.ytimg.com/vi/EL4ZbRF587g/default.jpg)
![Longest Increasing Subsequence O(n log n) dynamic programming Java source code](https://i.ytimg.com/vi/22s1xxRvy28/default.jpg)
![Recitation 9: Rolling Hashes, Amortized Analysis](https://i.ytimg.com/vi/w6nuXg0BISo/default.jpg)
![Treap (Tree + Heap) Data Structure - Tutorial with Statistical Analysis](https://i.ytimg.com/vi/uwWOUAdOTig/default.jpg)
![9.2 Rabin-Karp String Matching Algorithm](https://i.ytimg.com/vi/qQ8vS2btsxI/default.jpg)
![Hash Tables and Hash Functions](https://i.ytimg.com/vi/KyUTuwz_b7Q/default.jpg)
![How hash function work?](https://i.ytimg.com/vi/xsp--srKWKw/default.jpg)
![Rolling hash | Rabin karp algorithm | Pattern searching](https://i.ytimg.com/vi/BQ9E-2umSWc/default.jpg)
![Rabin Karp Substring Search Pattern Matching](https://i.ytimg.com/vi/H4VrKHVG5qI/default.jpg)
![Lecture 9: Table Doubling, Karp-Rabin](https://i.ytimg.com/vi/BRO7mVIFt08/default.jpg)
![Partition to K Equal Sum Subsets - source code & running time recurrence relation](https://i.ytimg.com/vi/DB-9JlnbBpM/default.jpg)
![Hashes 4 Hash Functions for Strings](https://i.ytimg.com/vi/jtMwp0FqEcg/default.jpg)
![Graph Data Structure 4. Dijkstra’s Shortest Path Algorithm](https://i.ytimg.com/vi/pVfj6mxhdMw/default.jpg)
![Rabin-Karp Algorithm | Searching for Patterns | GeeksforGeeks](https://i.ytimg.com/vi/oxd_Z1osgCk/default.jpg)
![Matrix Chain Multiplication - Dynamic Programming (DP) Print Parentheses - Java source code](https://i.ytimg.com/vi/JMql7zF87aE/default.jpg)
![ADS1: Boyer-Moore basics](https://i.ytimg.com/vi/4Xyhb72LCX4/default.jpg)
![Knuth-Morris-Pratt (KMP) algorithm | String Matching Algorithm | Substring Search](https://i.ytimg.com/vi/4jY57Ehc14Y/default.jpg)
![Disc/Washer Method vs. Shell Method (rotated about different lines)](https://i.ytimg.com/vi/ydyXf01WNYA/default.jpg)
![Rolling Hash - CP TacTics | Rabin-Karp Algorithm for Pattern Searching | The Code Mate](https://i.ytimg.com/vi/qgtAaQHKLx8/default.jpg)
![Longest Duplicate Substring | TRIE | Rolling Hash | Binary Search | Leetcode #1044](https://i.ytimg.com/vi/FQ8hcOOzQMU/default.jpg)