Class PatternMatching

java.lang.Object
com.zybooks.dsaj.text.PatternMatching

public class PatternMatching extends Object
Implementation of several pattern-matching algorithms on character sequences.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    findBoyerMoore(char[] text, char[] pattern)
    Returns the lowest index at which substring pattern begins in text (or else -1).
    static int
    findBrute(char[] text, char[] pattern)
    Returns the lowest index at which substring pattern begins in text (or else -1).
    static int
    findKMP(char[] text, char[] pattern)
    Returns the lowest index at which substring pattern begins in text (or else -1).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PatternMatching

      public PatternMatching()
  • Method Details

    • findBrute

      public static int findBrute(char[] text, char[] pattern)
      Returns the lowest index at which substring pattern begins in text (or else -1).
    • findBoyerMoore

      public static int findBoyerMoore(char[] text, char[] pattern)
      Returns the lowest index at which substring pattern begins in text (or else -1).
    • findKMP

      public static int findKMP(char[] text, char[] pattern)
      Returns the lowest index at which substring pattern begins in text (or else -1).