Simple Explanation And Implementation Of Knuth-Morris-Pratt (KMP) Algorithm For String Search

Introduction We have seen brute force approach to string search here. Brute force approach to string search has time complexity of O(n*m). Donald Knuth and Vaughan Pratt, and James H. Morris conceived the algorithm in 1970. KMP algorithm is the first algorithm to have linear time complexity. Problem Statement We will assume text (where weContinue reading “Simple Explanation And Implementation Of Knuth-Morris-Pratt (KMP) Algorithm For String Search”

Dynamic Programming : An example showing Lowest Common Subsequence in Java

Introduction Optimal Substructure : A problem is said to be a optimal substructure if an optimal solution can be constructed from optimal solution of it’s subproblem. Overlapping subproblemsĀ : A problem is said to have overlapping subproblems if the problem can be broken down into repetitive subproblems. Greedy Algorithm is used to solve problems having optimalContinue reading “Dynamic Programming : An example showing Lowest Common Subsequence in Java”