String algorithm suggestion to find all the common prefixes of a list of strings -
String algorithm suggestion to find all the common prefixes of a list of strings - what algorithm suggest find out longest mutual prefixes of list of strings? i might have strings such as: call mike , schedule meeting. phone call lisa phone call adam , inquire quote. implement new class iphone project implement new class rails controller purchase groceries i want find out next prefixes: "call " "implement new class " i'll using objective c, ready made cocoa solution plus (though not must). edit: clarified question: sort strings find longest mutual prefix of each adjacent pair sort , dedupe mutual prefixes, remove that's strict prefix of another. actually, step (3) requires remove that's dupe/prefix of another, trie or whatever instead of sorting. in fact may whole thing can done faster suitably annotated trie - if include "count" @ each node you're looking exactly nodes count of 2+, have no children c...