Re: [algogeeks] remove duplicate words from a string

2011-10-11 Thread rahul sharma
if the string is sorted then int rmvDup(char arr[],int arrLen) { int i,j; for (i =1,j=0; i arrLen;i++) { if (arr[j] != arr[i]) { arr[j+1] = arr[i]; j = j+1; } } arr[j]='\0'; return j+1; } On Tue, Oct 11, 2011 at 9:18

Re: [algogeeks] remove duplicate words from a string

2011-10-11 Thread sachin goyal
lets take an example... hello naveen how are you naveen? how we can store the word each seperated by space into array if we are considering binary tree??? how we can measure which is smaller than other according to property?? if we store each word into hash table then how

Re: [algogeeks] remove duplicate words from a string

2011-10-11 Thread sunny agrawal
1. how we can store the word each seperated by space into array if we are considering binary tree??? Ans: Each Node will Have an array of Some Const Size limited by Max Word length 2. how we can measure which is smaller than other according to property?? Ans Obviously strcmp(str1,

[algogeeks] remove duplicate words from a string

2011-10-10 Thread sachin goyal
remove duplicate words from a string with min. complexityy. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] remove duplicate words from a string

2011-10-10 Thread Ankur Garg
I think this can be done through tries Any better solution ? On Mon, Oct 10, 2011 at 10:59 PM, sachin goyal monugoya...@gmail.comwrote: remove duplicate words from a string with min. complexityy. -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] remove duplicate words from a string

2011-10-10 Thread sunny agrawal
Trie will take too much space.. Balanced Binary tree can be Better ...?? On Tue, Oct 11, 2011 at 12:16 AM, Ankur Garg ankurga...@gmail.com wrote: I think this can be done through tries Any better solution ? On Mon, Oct 10, 2011 at 10:59 PM, sachin goyal monugoya...@gmail.comwrote: remove

Re: [algogeeks] remove duplicate words from a string

2011-10-10 Thread Ankur Garg
@Sunny..How do u intend to store them in a Tree ? Can you explain ? 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 .Alternatively u store the elements in a trie in the initial string and terminate it

Re: [algogeeks] remove duplicate words from a string

2011-10-10 Thread sunny agrawal
@Ankur in Trie at each Node there will be 26 Pointers Stored, and Most of them would be NULL, thats why i think it will waste space, in Balanced Binary Tree i was thinking of storing the Complete Words at a Node. But now i think this is Better - Ternary Search

[algogeeks] remove duplicate words in a string

2011-08-05 Thread vaibhav shukla
Given a string,remove all duplicates words: input: where there is a will there is a way o/p : where will way. -- best wishes!! Vaibhav MCA -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to