Re: [algogeeks] Remove all Duplicates Words

2011-08-24 Thread sagar pareek
use hashing

On Wed, Aug 24, 2011 at 8:43 PM, UMESH KUMAR kumar.umesh...@gmail.comwrote:

 Qn. Remove all duplicates words from given a line without using extra
 memory ?

 Ex:-Hello word hello hi
 Out put:- Hello word hi

  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Remove all Duplicates Words

2011-08-24 Thread Ankur Garg
Both of these methods will require extra ,memory

On Wed, Aug 24, 2011 at 9:42 PM, Anup Ghatage ghat...@gmail.com wrote:

 How about this,
 We compare the first character with every character except the characters
 in the word itself, if there is a hit, it might be a word which is a
 duplicate.
 So from there on, compare each of the following characters till there is a
 white space or new line character.
 If there is no match, skip all the next characters and start with the next
 word's first character, but search only from that index to n.
 if there is a complete match, shift all the characters following the
 duplicate to the duplicates position.

 Finding the same first characters: O(n)
 Finding if they are duplicates: O(n)

  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Remove all Duplicates Words

2011-08-24 Thread kritivasas shukla
how about using a trie tree??

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Remove all Duplicates Words

2011-08-24 Thread Gaurav Menghani
Do you mean even O(1) isn't good?

On Wed, Aug 24, 2011 at 8:43 PM, UMESH KUMAR kumar.umesh...@gmail.com wrote:
 Qn. Remove all duplicates words from given a line without using extra memory
 ?
 Ex:-Hello word hello hi
 Out put:- Hello word hi

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Gaurav Menghani

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Remove all Duplicates Words

2011-08-24 Thread *$*
how about suffix tree?

On Thu, Aug 25, 2011 at 4:22 AM, Gaurav Menghani
gaurav.mengh...@gmail.comwrote:

 Do you mean even O(1) isn't good?

 On Wed, Aug 24, 2011 at 8:43 PM, UMESH KUMAR kumar.umesh...@gmail.com
 wrote:
  Qn. Remove all duplicates words from given a line without using extra
 memory
  ?
  Ex:-Hello word hello hi
  Out put:- Hello word hi
 
  --
  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
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 



 --
 Gaurav Menghani

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Thx,
--Gopi

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.