YSC2229: Introductory Data Structures and Algorithms
  • 1. Software Prerequisites
  • 2. OCaml Style Guide
  • 3. Policies
  • 4. Midterm Project: Memory Allocation and Reclamation
  • 5. Final Project: Vroomba Programming
  • 1. Chapter 01: Introduction
  • 2. Chapter 02: Working with Arrays
  • 3. Chapter 03: Complexity of Algorithms and Order Notation
  • 4. Chapter 04: Divide-and-Conquer Algorithms
  • 5. Chapter 05: Binary Heaps and Priority Queues
  • 6. Chapter 06: Abstract Data Types
  • 7. Chapter 07: Hashing-Based Data Structures
  • 8. Chapter 08: Searching in Strings
    • 8.1. Substring Search
    • 8.2. Rabin-Karp Search
    • 8.3. Knuth–Morris–Pratt Algorithm
    • 8.4. Exercises
  • 9. Chapter 09: Backtracking and Dynamic Programming
  • 10. Chapter 10: Data Encoding and Compression
  • 11. Chapter 11: Binary Search Trees
  • 12. Chapter 12: Graph Algorithms
  • 13. Chapter 13: Elements of Computational Geometry
YSC2229: Introductory Data Structures and Algorithms
  • »
  • 8. Chapter 08: Searching in Strings

8. Chapter 08: Searching in Strings

  • 8.1. Substring Search
    • 8.1.1. Testing a search procedure
    • 8.1.2. A very naive search
    • 8.1.3. A slightly better naive search
    • 8.1.4. A recursive version of the naive search
    • 8.1.5. Testing naive search
  • 8.2. Rabin-Karp Search
    • 8.2.1. Recursive version of Rabin-Karp search
    • 8.2.2. Comparing performance of search procedures
  • 8.3. Knuth–Morris–Pratt Algorithm
    • 8.3.1. Revisiting the naive algorithm
    • 8.3.2. Returning the Interrupt Index
    • 8.3.3. Relating Matched Text and the pattern
    • 8.3.4. Fast-Forwarding Search using Interrupt Index
    • 8.3.5. Extracting the Interrupt Index
    • 8.3.6. Exploiting the Prefix Equality
    • 8.3.7. Tabulating the interrupt indices
    • 8.3.8. Boot-strapping the table
    • 8.3.9. Comparing performance, again
  • 8.4. Exercises
    • 8.4.1. Exercise 1
    • 8.4.2. Exercise 2
    • 8.4.3. Exercise 3
Previous Next

© Copyright 2021, Ilya Sergey.

Built with Sphinx using a theme provided by Read the Docs.