Re: [algogeeks] Re: absolute minimum difference

2012-07-28 Thread SHOBHIT GUPTA
@Arun : sort the array acc to their abs values . On Sat, Jul 28, 2012 at 9:51 AM, Arun Kindra arunkin...@gmail.com wrote: @Dave Sir : Sir if u sort the array(given above) the array would be: -20,-8-2,4,9,10,12,14,17, and according to ur suggestion, the only ans is {9,10}...but one of the ans

Re: [algogeeks] adobe aptitude test

2012-07-28 Thread Avinash Mishra
Could u tell me about question u got?? On 25 July 2012 22:02, Amit Jain aj201...@gmail.com wrote: I assumed, You were called for Interview off-campus. It depends upon the profile You have been called for. BTW it was too easy for White box testing. On Wed, Jul 25, 2012 at 8:13 PM,

[algogeeks] Re: absolute minimum difference

2012-07-28 Thread Krishna Kishore
In O(n^2 ) we can do. But in O(n) i don't get any idea. If any one got the idea just explain. On Friday, 27 July 2012 15:35:24 UTC+5:30, Navin Kumar wrote: Given array of integers (0 or +ve or -ve value) find two elements having minimum difference in their absolute values. e.g. Input {10 ,

Re: [algogeeks] Fwd: general tree into BST

2012-07-28 Thread Kumar Vishal
Take all element sort them and Make BST then Convert it to Red Black Tree On Fri, Jul 27, 2012 at 7:11 AM, Sathish babu satbrucei...@gmail.comwrote: **~Sathish Babu~** -- Forwarded message -- From: Sathish babu satbrucei...@gmail.com Date: Wed, Jul 25, 2012 at 9:52

Re: [algogeeks] what will be output for this program ?

2012-07-28 Thread SHOBHIT GUPTA
64 32 16 32 16 32 64 32 Wats d prob ? On Fri, Jul 27, 2012 at 6:48 PM, Hraday Sharma hradaysha...@gmail.comwrote: #includestdio.h int main(){ printf(%d %d\n, 321, 320); printf(%d %d\n, 32-1, 32-0); printf(%d %d\n, 321, 320); printf(%d %d\n, 32-1, 32-0); return 0;

Re: [algogeeks] what will be output for this program ?

2012-07-28 Thread Sathish babu
can you explain 32-1 **~Sathish Babu~** On Fri, Jul 27, 2012 at 11:39 PM, SHOBHIT GUPTA shobhitgupta1...@gmail.comwrote: 64 32 16 32 16 32 64 32 Wats d prob ? On Fri, Jul 27, 2012 at 6:48 PM, Hraday Sharma hradaysha...@gmail.comwrote: #includestdio.h int main(){ printf(%d %d\n,

Re: [algogeeks] adobe aptitude test

2012-07-28 Thread vivek goel
Hello all, i need help for Adobe and Amazon test asap ( Developer profile for both ). On Fri, Jul 27, 2012 at 11:33 PM, Avinash Mishra mishra.avinas...@gmail.com wrote: Could u tell me about question u got?? On 25 July 2012 22:02, Amit Jain aj201...@gmail.com wrote: I assumed, You were

[algogeeks] Equal probability between 1-7

2012-07-28 Thread arpit agrawal
Write a method to generate a random number between 1 and 7, given a method that generates a random number between 1 and 5. The distribution between each of the numbers must be uniform -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

[algogeeks] Re: Equal probability between 1-7

2012-07-28 Thread deepikaanand
int rand7() { int x = 5*rand5() + rand5(); //enlarge the range from (0 to 5 )to 0 to 24 by multiplying with 5 if(x 20) return rand7() ;//recursive call else return x%7;//this will result in uniform distribution of number between 0-6 } -- You received this message because you are subscribed

[algogeeks] Re: Equal probability between 1-7

2012-07-28 Thread Don
int rand7() { int result; do { result = (rand5() + 5*rand5()-3) / 3; } while(result 7); return result; } On Jul 28, 8:08 am, arpit agrawal reallygeni...@gmail.com wrote: Write a method to generate a random number between 1 and 7, given a method that generates a

[algogeeks] Re: absolute minimum difference

2012-07-28 Thread jatin
was thinking that we can make a BST and and inorder traversal(both using abs values) o(n) though will take log(n) space. On Friday, 27 July 2012 15:35:24 UTC+5:30, Navin Kumar wrote: Given array of integers (0 or +ve or -ve value) find two elements having minimum difference in their absolute

[algogeeks] graph theory library?

2012-07-28 Thread Hatta
is there an ANSI (either C or C++) library around that implements common graph algorithms? any pointer is appreciated. thanks in advance. -- Hatta -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] Re:

2012-07-28 Thread Shailesh
This function is enough to do the work. void StringCount (char *str, int strlen) { int l_iFirstIterator = 0, l_iSecondIterator = 1, l_iCount = 0; while (l_iFirstIterator strlen) { l_iCount = 0; while (str [l_iFirstIterator] == str

Re: [algogeeks] Re: Equal probability between 1-7

2012-07-28 Thread Megha
@deepika- can you please explain the approach for this solution ? -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. deepikaanand swinyanand...@gmail.com wrote: int rand7() { int x = 5*rand5() + rand5(); //enlarge the range from (0 to 5 )to 0 to 24 by multiplying with 5 if(x

Re: [algogeeks] Re: Equal probability between 1-7

2012-07-28 Thread Karthikeyan Muthu
On Sat, Jul 28, 2012 at 6:58 PM, Megha megha14.2...@gmail.com wrote: @deepika- can you please explain the approach for this solution ? -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. @megha 'rejection sampling' is going to be your search key deepikaanand