Re: [algogeeks]

2011-09-19 Thread Sandy
@Utkarsh:  In Yogesh's code assigning a[1] to largest and second_largest in
the beginning, -VE case will be handled.

On Mon, Sep 19, 2011 at 12:10 PM, asdqwe  wrote:

> @Yogesh:fails for negative numbers..
>
> (though I am also confused with the ques)
>
> On Sep 19, 10:38 am, Yogesh Yadav  wrote:
> > current position is index n (say)
> > largest=0;
> > second_largest=0;
> >
> > for(i=1;i<=n;i++)
> > {
> > if(a[i]>a[n])
> > {
> > if(a[i]>largest)
> > {
> > second_largest=largest;
> > largest=a[i];}
> >
> > elseif(a[i]>second_largest)
> > second_largest=a[i];
> >
> > }
> > }
> >
> > 
> >
> >
> >
> >
> >
> >
> >
> > On Mon, Sep 19, 2011 at 2:15 AM, sagar pareek 
> wrote:
> > > Give some examples ,i m not getting ur question
> >
> > > On Mon, Sep 19, 2011 at 1:45 AM, UTKARSH SRIVASTAV <
> > > usrivastav...@gmail.com> wrote:
> >
> > >> how to find second largest element than current element in an array
> given
> > >> condition that we have to find that second largest element from index
> 1 to
> > >> the index of the current element
> >
> > >> --
> > >> *UTKARSH SRIVASTAV
> > >> CSE-3
> > >> B-Tech 3rd Year
> > >> @MNNIT 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.
> >
> > > --
> > > **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.
>
> --
> 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.
>
>


-- 

*Sandeep Kumar,*
 ( Mobile +91-9866507368

*“I believe in smart work, Believe Me”*

-- 
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] plzzzzzzzz heeeppppp!!!!!!!!!!1

2011-09-15 Thread Sandy
Lots of guys already have shared interesting facts.

Here is a good saying - "Knowing that a bottle of COKE will burst like a
fountain if opened after shaking.  Someone who tries that to validate it has
a Testing DNA"

Here are some more differences that can help you make choices :)

Developer:
1.  Works towards clear cut requirements and implements that in
most-efficient manner.
2.  Language is fixed - If the product is being developed in C++ that's the
only language you use (Limited by limitations of language).
3.  Least Creative until unless you work as a UI Developer on an appealing
UI product (e.g. Apple iPAD, Windows Phone, Windows 8).
4.  As number of years grow in that role, You Build Depth in one area.

SDET:
1.  Validates that implementation meets the requirements as well as is the
most-efficient by Writing Automated Tests/Tools that can validate that.
(Best example to think is how does Google Search Engine get tested, How
Microsoft tests Excel, How Visual Studio is tested) - These are softwares
that demand SMART ways of testing, Not boring ways of running some tests
manually.  Which tells why they want SDETs and not Testers.

2.  Choose whatever language suits your needs (Scripting, C++, C#,
Powershell, Perl etc).
3.  Build Breadth in Many Areas (Depth in areas you like the most).
4.  Creative:  Testing demands creativity, Think about customers and come up
with interesting scenarios in which customers will use the product.

Apart from these definitions a lot depends on the team you join and the kind
of work it does.  You will find Un-Satisfied Developers as well as Testers.


On Thu, Sep 15, 2011 at 10:47 PM, vivek goel wrote:

> hey nikhil,
>  thanks a lot bro..
>
>
> On Thu, Sep 15, 2011 at 8:10 PM, Nikhil Kumar wrote:
>
>> @vivek : If you opt for testing , you can always become a developer.It
>> won't go hard on you.
>>
>> And I don't really know about consultant, you have to ask some guy in the
>> force.
>>
>>
>> On Thu, Sep 15, 2011 at 5:15 AM, sukran dhawan wrote:
>>
>>> Just opt fot testing ... If there is a slot for development in the
>>> company they will look for the guys in testing first b4 actually going for
>>> outside ppl
>>>
>>> And u can easily shift from testing to development if u perform well
>>>
>>>
>>> On Thu, Sep 15, 2011 at 10:57 AM, rahul sharma 
>>> wrote:
>>>
 hey guys plz tell the difference b/w testing n develp.  profile ??? n
 joing i n testing profile has growth as much as in develpoer???plz
 tell soon..?should i go in testing profile in lagre industry or in
 developer in medium scale...plz hepl

 --
 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.
>>>
>>
>>
>>
>> --
>> Nikhil Kumar , Software Engineer @ Ciena Gurgaon.
>> B.E.( Information Technology ) ,
>> NSIT Delhi , 2007-2011
>>
>>  --
>> 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.
>



-- 

*Sandeep Kumar,*
 ( Mobile +91-9866507368

*“I believe in smart work, Believe Me”*

-- 
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] Exchanging bit values in a number

2011-09-13 Thread Sandy
@Ankit.

n= 1101

i=2 j=3

x = (2^j + 2^i) =  1100
x^n =  0001

Answer should be  1101.

On Wed, Sep 14, 2011 at 12:39 AM, Ankit Agarwal wrote:

> let x = 2^j + 2 ^i
> new number after swapping the digits is x XOR n
>
> eg n =  1101
> j = 6 i = 2
> x = 0100 0100
>  new number = x XOR n = 0100 1001
>
>
> --
> Ankit Agarwal
> Computer Science & Engg.
> Integrated Dual Degree, V yr
> Department of Electronics & Computer Engineering
> Indian Institute of Technology Roorkee
> Ph. no. +91-9580098805
>
>  --
> 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.
>



-- 

*Sandeep Kumar,*
 ( Mobile +91-9866507368

*“I believe in smart work, Believe Me”*

-- 
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] Solve this problem

2011-09-10 Thread Sandy
http://stackoverflow.com/questions/6967853/dynamic-programming-can-interval-of-even-1s-and-0s-be-found-in-linear-time

On Sun, Sep 11, 2011 at 12:10 AM, Neha Singh wrote:

> Can't hv linear solution to this problem. The no. of intervals itself can
> be of the order of O(n^2)
>
> --
> 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.
>



-- 

*Sandeep Kumar,*
 ( Mobile +91-9866507368

*“I believe in smart work, Believe Me”*

-- 
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] Re: Element in Array Repeated Even Number of Times

2011-09-07 Thread Sandy
Thanks Dave, Piyush, and Bittursk.

On Wed, Sep 7, 2011 at 2:48 PM, Dave  wrote:

> @Sandy: It can be done in O(n) time with O(n) extra space by sorting
> the data with a radix sort and then scanning the array for the element
> you are seeking.
>
> Dave
>
> On Sep 7, 11:43 am, Sandy  wrote:
> > You have an array in which every number is repeated odd number of times
> > except one.  Write a function to find that one element in O(n) time.
> >
> > --
> >
> > *Sandeep Kumar,*
> >  ( Mobile +91-9866507368
> >
> > *“I believe in smart work, Believe Me”*
>
> --
> 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.
>
>


-- 

*Sandeep Kumar,*
 ( Mobile +91-9866507368

*“I believe in smart work, Believe Me”*

-- 
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] Re: Element in Array Repeated Even Number of Times

2011-09-07 Thread Sandy
@Rahul - Can you explain the logic and complexity?

On Wed, Sep 7, 2011 at 11:06 PM, Rahul Thankachan wrote:

>
>
> On Sep 7, 12:43 pm, Sandy  wrote:
> > You have an array in which every number is repeated odd number of times
> > except one.  Write a function to find that one element in O(n) time.
> >
> > --
> >
> > *Sandeep Kumar,*
> >  ( Mobile+91-9866507368begin_of_the_skype_highlighting
> +91-9866507368
> >
> > *“I believe in smart work, Believe Me”*
>
>
> sry i made the logic for the opp for even instead..u just need to
> change sm values...u will get it :):) its simple..
>
> --
> 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.
>
>


-- 

*Sandeep Kumar,*
 ( Mobile +91-9866507368

*“I believe in smart work, Believe Me”*

-- 
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] Element in Array Repeated Even Number of Times

2011-09-07 Thread Sandy
You have an array in which every number is repeated odd number of times
except one.  Write a function to find that one element in O(n) time.

-- 

*Sandeep Kumar,*
 ( Mobile +91-9866507368

*“I believe in smart work, Believe Me”*

-- 
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] Re: problems about the puzzle "Chameleon"

2011-09-06 Thread Sandy
@SandeepGupta: That ways red will be 15.

On Tue, Sep 6, 2011 at 9:43 PM, sandeep gupta wrote:

> let the blue and green chameleon meet first.
> Result :
> 14 - red
> 14 - green
> 16 - blue
> now 14 times pair of red and green meet to make it all 44 blue
>
> On Sep 5, 11:44 pm, Don  wrote:
> > Yes, you are right, it is 4 in that case. It seems that f is always
> > even. It is possible for 44 chameleons to be one color, but then there
> > is only one left and it cannot change to that color. Any time there
> > are 43 chameleons of one color, the other two are the same color.
> >  It is true that all the chameleons can never be the same color, but I
> > agree that his "proof" is not valid.
> > Don
> >
> > On Sep 5, 9:08 pm, wujin chen  wrote:
> >
> >
> >
> > > hi Don, i think f(15,14,16) =|15-14|+|14-16|+|16-15| = 1+2+1=4, hou do
> you
> > > get f(15,14,16) = 5?
> >
> > > 2011/9/6 Don 
> >
> > > > No, f(15,14,16) = 5.
> > > > Don
> >
> > > > On Sep 5, 8:33 pm, wujin chen  wrote:
> > > > > hi all, i encountered this puzzle (
> http://www.crackpuzzles.com/?p=236):
> >
> > > > > At one point, a remote island's population of chameleons was
> divided as
> > > > > follows:
> > > > > - 13 red chameleons
> > > > > - 15 green chameleons
> > > > > - 17 blue chameleons
> > > > > Each time two different colored chameleons would meet, they would
> change
> > > > > their color to the third one. (i.e.. If green meets red, they both
> change
> > > > > their color to blue.) Is it ever possible for all chameleons to
> become
> > > > the
> > > > > same color? Why or why not?"
> >
> > > > > and the solution provided by auther is like this:
> > > > > *Solution: *
> > > > > Lets define a function f(red, blue, green) = |red - blue| + |blue -
> > > > green| +
> > > > > |green - red|
> > > > > When two chameleons of different colours meet and convert to the
> third
> > > > one,
> > > > > the value of function f will always change by 0 or 3 or 6 (i.e. a
> > > > multiple
> > > > > of 3). In the initial situation f is 8.
> > > > > If all of them get converted into a single colour then f would be
> 90 =
> > > > > 2*(red+blue+green)
> > > > > So we are basically looking for a solution to the equation: 8 + 3x
> = 90,
> > > > > which has no integer solutions. Hence it is not possible.
> >
> > > > > well, my problem is this:
> >
> > > > > f(13,15,17)=8,
> > > > > f(15,14,16)=2
> > > > > so , we can see that " the value of function f will always change
> by 0 or
> > > > 3
> > > > > or 6″ is not true, i am wondering~!
> >
> > > > --
> > > > 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.- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> 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.
>
>


-- 

*Sandeep Kumar,*
 ( Mobile +91-9866507368

*“I believe in smart work, Believe Me”*

-- 
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] C output????

2011-09-06 Thread Sandy
String constants (literals) are saved into the .data section of the program,
 Here is the sample program to show that.  if() is essentially comparing the
addresses of two pointers which is same.

int main()
{
char *p="persons";
char *q="persons";
char *r="persons";
char *s="persons";
 printf("%x %x %x %x\n",p,q,r,s);
if(p=="persons")
printf("technical %s",p);
else
printf("true %s",p);
return 0;
}
-
Output:
403021 403021 403021 403021
technical persons

On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s wrote:

>
> main()
> {
> char *p="persons";
> clrscr();
> if(p=="persons")
> printf("technical %s",p);
> else
> printf("true %s",p);
> return 0;
> }
>
> ..op : technical persons ..plz explain .. how come it works like an strcmp
> operation???
> --
> Regards,
> $iva
>
>  --
> 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.
>



-- 

*Sandeep Kumar,*
 ( Mobile +91-9866507368

*“I believe in smart work, Believe Me”*

-- 
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] Re: macro

2011-09-06 Thread Sandy
What is the practical application of this expression?

On Tue, Sep 6, 2011 at 5:38 PM, Dave  wrote:

> @Mohit: If n is a power of 2, then the macro returns x if x is a
> multiple of n or x rounded up to the next multiple of n if x is not a
> multiple of n. E.g., ROUNDUP(16,4) = 16 and ROUNDUP(17,4) = 20. The
> result doesn't appear useful if n is not a power of 2.
>
> Since ~(n-1) = -n, it could be written more compactly as
>
>  #define ROUNDUP(x,n) ((x+n-1)&(-(n)))
>
> Dave
>
> On Sep 6, 5:06 am, Mohit Goel  wrote:
> >  #define ROUNDUP(x,n) ((x+n-1)&(~(n-1)))
> >
> > what does the following macro do 
>
> --
> 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.
>
>


-- 

*Sandeep Kumar,*
 ( Mobile +91-9866507368

*“I believe in smart work, Believe Me”*

-- 
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] java books???

2011-09-06 Thread Sandy
Java How To Program - Deitel & Deitel

On Tue, Sep 6, 2011 at 5:38 PM, htross  wrote:

> guys i need to prepare for java aptitude so please refer some
> books..
>
> --
> 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.
>
>


-- 

*Sandeep,*

*“I believe in smart work, Believe Me”*

-- 
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] any one can help.. please help

2011-04-02 Thread sandy
question : A programmer wants to test whether or not n given
conditions are all simultaneously true (e.g he may want to test
whether both x>0 and yhttp://groups.google.com/group/algogeeks?hl=en.



[algogeeks] real coders ---> please help me..

2011-04-02 Thread sandy
hey guys please help me to solve this

QUESTION :  input a number C , an output all of the ways that a group
of ascending positive numbers can be summed to give C. for e.g if
C=6,the output should be
1+2+3
1+5
2+4
[solve using dynamic programming]

please tell me about this..

-- 
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] can i know the best way to learn programming??

2011-01-31 Thread sandy
plz help

-- 
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: permuting the elements of an array

2009-08-19 Thread sandy

Please see http://geeksforgeeks.org/?p=767 for well explained C
implementation of the same.

On Jun 23, 10:01 am, Ajinkya Kale  wrote:
> Yeah c++ STL nextpermutation api will do it .. good solution Miroslav!
>
> On Tue, Jun 23, 2009 at 10:25 PM, Miroslav Balaz 
> wrote:
>
>
>
> > It is also so easy, but maybe requires more lines of code
>
> > you only need count number of used number for each 1..n
> > and then...(repeat recursive approach)
>
> > ONE LINE SOLUTION IN C++
>
> > ok use next permutation from STL, read how it works for other language
> > and initialize array 11223344, and do while next_permutaion()...
> > it actualy gives you always next lexicographical permutation of sequence
>
> > you can also view source code of it in libraries
>
> > 2009/6/23 Ralph Boland 
>
> >> I have an array of objects and I need to generate all permutations.
> >> e.g.  for [1,2,3]   I get:
> >> [1,2,3]
> >> [1,3,2]
> >> [2,1,3]
> >> [2,3,1]
> >> [3,1,2]
> >> [3,2,1]
>
> >> This problem is actually easy to solve and in fact there is a purely
> >> iterative solution.
> >> However in my case I also need to solve a variant of this problem.
> >> In this variant the array has 2n elements grouped into n groups of two
> >> elements
> >> where each 2 element pair are equal.
> >> For example for array  [1,1,2,2]  I get:
> >> [1,1,2,2]
> >> [1,2,1,2]
> >> [1,2,2,1]
> >> [2,1,1,2]
> >> [2,1,2,1]
> >> [2,2,1,1]
>
> >> Note that in the first case I get n! permutations whereas in the
> >> second case
> >> I get  (2n)! / 2^n  permutations.  I want to generate the permutations
> >> efficiently.
> >> I particular it is unacceptable to generate the (2n)! combinations and
> >> then
> >> remove the duplicates.   I have come up only with complicated ways of
> >> doing this
> >> but I am hoping someone can post or reference a simpler solution.
> >> A solution that generalizes in various ways would be nice but not
> >> important to my
> >> particular problem.
>
> >> I will be implementing the final solution in Smalltalk (Squeak) and
> >> eventually in other
> >> languages as part of an implentation of the spine tree decomposition
> >> data structure.
> >> It will be released (in Squeak at least) under the MIT license.
>
> >> Thanks for any help provided.
>
> >> Ralph Boland
>
> --
> Ciao,
> Ajinkya

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



[algogeeks] Re: Check divisibility by 3

2009-08-19 Thread sandy

This is solved and very well explained at http://geeksforgeeks.org/?p=511

On Aug 17, 7:19 am, Abhijeet Kumar  wrote:
> i think the code given above doesn't work ..
> so may be dat needs to be checked 
> any better ideas??
>
>
>
> On Mon, Aug 17, 2009 at 7:20 PM, manish bhatia  wrote:
> > Keep adding the digits till you are reduced to single digit. Then check if
> > it is 3, 6 or 9
>
> >  --
> > *From:* richa gupta 
> > *To:* programming-puzzles ;
> > algogeeks 
> > *Sent:* Friday, 14 August, 2009 1:15:13 PM
> > *Subject:* [algogeeks] Check divisibility by 3
>
> > can we check the divisibility of a given number by 3 withoutusing
> > operators like '/' or '%'..
> > I want the efficient solution to this problem ..
>
> > can someone help ??
> > --
> > Richa Gupta
> > (IT-BHU,India)
>
> > --
> > Yahoo! recommends that you upgrade to the new and safer Internet Explorer
> > 8
> > .
>
> --
> Abhijeet

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