Algorithms and data structures for JS/TS
  • Introduction
  • GETTING STARTED
    • TS
    • Node.js
    • ES Modules
    • Browsers
  • PUBLIC API
    • How to read
    • Linked lists
      • SinglyLinkedList
      • DoublyLinkedList
      • CircularlyLinkedList
    • Stacks and queues
      • LinkedStack
      • LinkedQueue
      • LinkedDeque
      • CircularQueue
      • CircularArrayBuffer
      • UnsortedPriorityQueue
      • SortedPriorityQueue
      • AdaptableHeapPriorityQueue
    • Maps
      • SortedMap
      • MaximaSet
      • AVLTreeMap
      • SplayTreeMap
      • RedBlackTreeMap
    • Trees
      • GeneralTree
      • LinkedBinaryTree
      • PreorderTreeTraversal
      • InorderTreeTraversal
      • PostorderTreeTraversal
      • EulerTourTreeTraversal
    • Searches
      • Binary search
      • Quick select
    • Text processing
      • Longest common subsequence
      • Boyer-Moore
      • Knuth-Morris-Pratt
    • Position
    • Locator
    • Comparators
  • CONTRIBUTION NOTES
    • How to contribute
    • Project structure
  • Changelog
Powered by GitBook
On this page

Was this helpful?

  1. PUBLIC API
  2. Text processing

Boyer-Moore

Pattern-matching algorithm with pattern preprocessing and skips along portions of the text. Works better on longer alphabet sets.

indexOfBM()

/**
 * Finds pattern enclosure in the source string using Boyer-Moore algorithm.
 *
 * @param source Source string.
 * @param pattern Pattern string.
 * @returns The leftmost index at which the pattern begins in the source string or -1.
 */
function indexOfBM(source: string, pattern: string): number;
PreviousLongest common subsequenceNextKnuth-Morris-Pratt

Last updated 5 years ago

Was this helpful?