String analysis

This whole problem is known as “Common Subexpression Elimination” or CSE. It is a slightly smaller version of the problem called “Graph Reduction” faced by the implementer of compilers for functional programming languages. Googling “Common Subexpression elimination algorithm” gives lots of solutions, though none that I can see especially for the constraints given by matrix … Read more

How is it possible to build a suffix tree in linear time?

Your intuition behind why the algorithm should be Θ(n2) is a good one, but most suffix trees are designed in a way that eliminates the need for this time complexity. Intuitively, it would seem that you need Θ(n2) different nodes to hold all of the different suffixes, because you’d need n + (n – 1) … Read more

How to call module written with argparse in iPython notebook

An alternative to use argparse in Ipython notebooks is passing a string to: args = parser.parse_args() (line 303 from the git repo you referenced.) Would be something like: parser = argparse.ArgumentParser( description=’Searching longest common substring. ‘ ‘Uses Ukkonen\’s suffix tree algorithm and generalized suffix tree. ‘ ‘Written by Ilya Stepanov (c) 2013’) parser.add_argument( ‘strings’, metavar=”STRING”, … Read more

Ukkonen’s suffix tree algorithm in plain English

The following is an attempt to describe the Ukkonen algorithm by first showing what it does when the string is simple (i.e. does not contain any repeated characters), and then extending it to the full algorithm. First, a few preliminary statements. What we are building, is basically like a search trie. So there is a … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)