Sorry, small mistake in designated index calculation.
It should be k*p2 % (n-1) instead of (k*p2 -1) % (n - 1).
Thanks,
- Ravindra
On Thu, Nov 3, 2011 at 11:37 PM, ravindra patel wrote:
> This is a special case of shuffling problem. In shuffling problem we have
> to merge k (here k = 3) parts of
This is a special case of shuffling problem. In shuffling problem we have
to merge k (here k = 3) parts of array such that each kth element is from
the same sub-array and in same order. For eg -
a1 a2 a3 a4 b1 b2 b3 b4 c1 c2 c3 c4 should become => a1 b1 c1 a2 b2 c2 a3
b3 c3 a4 b4 c4.
Usually shuff
any solutions for this ?
dutch national flag problem could be done in O(n) time and O(1) space by
considering two pointers, but how to do this (reverse dutch national flag
problem) ?
On Sat, Aug 20, 2011 at 3:27 PM, Sanjay Rajpal wrote:
> Suppose we are given a string .
>
> Make it
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, Au
i think the soln for this problem is given in geeksforgeeks.com
On Sat, Aug 20, 2011 at 3:27 PM, Sanjay Rajpal 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
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