Re: [algogeeks] Re: Reverse dutch flag problem

2011-08-26 Thread sukran dhawan
count no of 0s,1s and 2s.fill first 0s followed by 1s den 2s :)

On Thu, Aug 25, 2011 at 11:37 PM, icy` vipe...@gmail.com wrote:

 not enough information, imo.   Tell me more about the given string...
 is the string made up of consecutive integers/characters ?  Are there
 always the same number of each character type?  And the goal is to
 braid , like the hairstyle, as much as possible (if the previous
 answer is no, all braids cannot be the same)?

 On Aug 25, 1:50 pm, sachin sabbarwal algowithsac...@gmail.com wrote:
  one solution might be:
  to traverse whole list counting no of zeros and 1's.
  and then make another string(or overwrite the same) with the required
  pattern,append any other characters(suppose all 0's exhausted and some
 1's
  and 2's were left) left at the end.
  is there any better solution??
 
  On Sat, Aug 20, 2011 at 4:20 PM, sukran dhawan sukrandha...@gmail.com
 wrote:
 
 
 
 
 
 
 
   i that .ink the soln for this problem is given in geeksforgeeks.com
 
   On Sat, Aug 20, 2011 at 3:27 PM, Sanjay Rajpal srn...@gmail.com
 wrote:
 
   Suppose we are given a string .
 
   Make it 012012012012 in O(n) time and O(1) space.
   Sanju
   :)
 
--
   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.

 --
 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.



[algogeeks] Re: Reverse dutch flag problem

2011-08-25 Thread icy`
not enough information, imo.   Tell me more about the given string...
is the string made up of consecutive integers/characters ?  Are there
always the same number of each character type?  And the goal is to
braid , like the hairstyle, as much as possible (if the previous
answer is no, all braids cannot be the same)?

On Aug 25, 1:50 pm, sachin sabbarwal algowithsac...@gmail.com wrote:
 one solution might be:
 to traverse whole list counting no of zeros and 1's.
 and then make another string(or overwrite the same) with the required
 pattern,append any other characters(suppose all 0's exhausted and some 1's
 and 2's were left) left at the end.
 is there any better solution??

 On Sat, Aug 20, 2011 at 4:20 PM, sukran dhawan sukrandha...@gmail.comwrote:







  i that .ink the soln for this problem is given in geeksforgeeks.com

  On Sat, Aug 20, 2011 at 3:27 PM, Sanjay Rajpal srn...@gmail.com wrote:

  Suppose we are given a string .

  Make it 012012012012 in O(n) time and O(1) space.
  Sanju
  :)

   --
  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.

-- 
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.