strings.boyer_moore_search
==========================

.. py:module:: strings.boyer_moore_search

.. autoapi-nested-parse::

   The algorithm finds the pattern in given text using following rule.

   The bad-character rule considers the mismatched character in Text.
   The next occurrence of that character to the left in Pattern is found,

   If the mismatched character occurs to the left in Pattern,
   a shift is proposed that aligns text block and pattern.

   If the mismatched character does not occur to the left in Pattern,
   a shift is proposed that moves the entirety of Pattern past
   the point of mismatch in the text.

   If there no mismatch then the pattern matches with text block.

   Time Complexity : O(n/m)
       n=length of main string
       m=length of pattern string



Attributes
----------

.. autoapisummary::

   strings.boyer_moore_search.bms
   strings.boyer_moore_search.pattern
   strings.boyer_moore_search.positions
   strings.boyer_moore_search.text


Classes
-------

.. autoapisummary::

   strings.boyer_moore_search.BoyerMooreSearch


Module Contents
---------------

.. py:class:: BoyerMooreSearch(text: str, pattern: str)

   .. py:method:: bad_character_heuristic() -> list[int]


   .. py:method:: match_in_pattern(char: str) -> int

      finds the index of char in pattern in reverse order

      Parameters :
          char (chr): character to be searched

      Returns :
          i (int): index of char from last in pattern
          -1 (int): if char is not found in pattern



   .. py:method:: mismatch_in_text(current_pos: int) -> int

      find the index of mis-matched character in text when compared with pattern
      from last

      Parameters :
          current_pos (int): current index position of text

      Returns :
          i (int): index of mismatched char from last in text
          -1 (int): if there is no mismatch between pattern and text block



.. py:data:: bms

.. py:data:: pattern
   :value: 'AB'


.. py:data:: positions
   :value: []


.. py:data:: text
   :value: 'ABAABA'