Re: [algogeeks] Permutation of Array.

2010-08-23 Thread BALARUKESH SIVARAMAN
now its clear.. thank you.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more

Re: [algogeeks] Permutation of Array.

2010-08-21 Thread BALARUKESH SIVARAMAN
@Nikhil I am clear with your first 2 algos but not with the change u introduced ie., adding a check. please give a working example -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Permutation of Array.

2010-08-19 Thread BALARUKESH SIVARAMAN
@Divya : Does the algo you gave work for the set { 6,5,9,111} ? I hope it doesnt... Correct me if i am wrong -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe

Re: [algogeeks] Re: unique number in an array

2010-06-15 Thread BALARUKESH SIVARAMAN
XOR has the following problem... assume array is 2,3,3,2,1,2 here the unique element is 1 but using XOR we get 2^3^3^2^1^2=3 XOR works only when all the elements except the unique element occur even number of times. -- You received this message because you are subscribed to the Google

Re: [algogeeks] Re: unique number in an array

2010-06-14 Thread BALARUKESH SIVARAMAN
sort the input and then compare each element i with its adjacent neighbors ie., i-1 and i+1 if both are different then that element is the unique one... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Mirroring Binary Tree Pattern Problem

2010-06-13 Thread BALARUKESH SIVARAMAN
try this one.. make a level order traversal and store the elements in array... on the other system reconstruct it using right element for the left and left element for the right... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

Re: [algogeeks] Problem with Virtual Function

2010-06-13 Thread BALARUKESH SIVARAMAN
In the first post the problem was that m_speed is not public also u should access m_speed using Scope resolution operator as m_speed is not a member of B. class A { public: virtual int speed()=0; int m_speed; }; class B:public A { public: int speed() { return A::m_speed; } }; For ur second

Re: [algogeeks] file handing

2010-06-13 Thread BALARUKESH SIVARAMAN
For the 1st qn.. the o/p will print the code in the file and then print an infinite sequence of empty spaces. the reason is... In C EOF is defined to hold a value -1 which when assigned to unsigned becomes 255. So it goes in an unending loop even after encountering the end of file. In second qn..

Re: [algogeeks] Re: infix

2010-06-11 Thread BALARUKESH SIVARAMAN
I missed out the condition that it should never be negative... Sorry for the comment... Thanks for correcting... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe