What are some algorithms for comparing how similar two strings are?

What you’re looking for are called String Metric algorithms. There a significant number of them, many with similar characteristics. Among the more popular: Levenshtein Distance : The minimum number of single-character edits required to change one word into the other. Strings do not have to be the same length Hamming Distance : The number of … Read more

What is the minimum cost to connect all the islands?

To approach this problem, I would use an integer programming framework and define three sets of decision variables: x_ij: A binary indicator variable for whether we build a bridge at water location (i, j). y_ijbcn: A binary indicator for whether water location (i, j) is the n^th location linking island b to island c. l_bc: … Read more

What is the difference between a heuristic and an algorithm?

An algorithm is the description of an automated solution to a problem. What the algorithm does is precisely defined. The solution could or could not be the best possible one but you know from the start what kind of result you will get. You implement the algorithm using some programming language to get (a part … Read more

Pacman: how do the eyes find their way back to the monster hole?

Actually, I’d say your approach is a pretty awesome solution, with almost zero-run time cost compared to any sort of pathfinding. If you need it to generalise to arbitrary maps, you could use any pathfinding algorithm – breadth-first search is simple to implement, for example – and use that to calculate which directions to encode … Read more

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