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
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
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,
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
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
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
@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
@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
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