[algogeeks] Re: remove duplicate words from a string

2011-10-13 Thread Abhishek Khanna
@Ankur In a trie u first insert the first word ..take the second word..If its not present in the trie u insert it else remove it from original string: removing the word requires left shifting the entire string Alternatively u store the elements in a trie in the initial string and terminate it

[algogeeks] Re: remove duplicate words from a string

2011-10-10 Thread icy`
a) 1. could split the string using a regexp (into an array) in which you define a word -- is hi. the same as hi, and hi ? 2. then perform a unique operation on the array (some languages have this built in) to remove duplicates 3. recombine array elements into string by joining with a space,