Interesting Challenge...
Posted: Sat Apr 30, 2011 1:42 am
I was reading a post on Craig's List where a company was asking for resumes, but they wanted you to solve a specific problem first.
As I do a ton of work like this, I thought it would be interesting to share and talk about.
I have settled on a way to do this without building a matrix, but I want to make sure it works for all 250,000 words in the word-list (below) before I post the results.
(it's in code form so you can copy and paste into your program ;) )
As I do a ton of work like this, I thought it would be interesting to share and talk about.
I have settled on a way to do this without building a matrix, but I want to make sure it works for all 250,000 words in the word-list (below) before I post the results.
(it's in code form so you can copy and paste into your program ;) )
Code: Select all
;
; Two words are friends if they have a Levenshtein distance of 1.
; That is, you can add, remove, or substitute exactly one letter in
; word X to create word Y.
; A words social network consists of all of its friends, plus all of
; their friends, and all of their friends friends, and so on.
;
; Write a program to tell us how big the
; social network for the word causes is, using this word list:
; https://github.com/causes/puzzles/raw/master/word_friends/word.list
;
; http://en.wikipedia.org/wiki/Levenshtein_distance
;
; tons of implementations in several languages
; http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance
;
; a working HTML version
; http://www.miislita.com/searchito/levenshtein-edit-distance.html
;