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”
Tag Archives: Interview Question
A beginner guide to Brute Force Algorithm for substring search
Introduction CONTROL + F or COMMAND + F How often do you use above keyboard shortcut? In fact, for most of us, searching a string or substring in a pile of strings/document is involuntarily action with the above key combination. This post will deal with the subject of the substring search. We will quickly defineContinue reading “A beginner guide to Brute Force Algorithm for substring search”
Depth First Search In Python to print nodes of Graph
Graph Shown above is a simple graph. Let’s define the characteristic of the graph: This is a connected graph. Meaning, you can travel from anywhere to anywhere in this graph. Read further here This is an undirected graph. That simply means we don’t have any direction sense to the arrow connecting two nodes This isContinue reading “Depth First Search In Python to print nodes of Graph”