Re: [algogeeks] Amazon Question - Find Pythagorean triplet in an unsorted array

2011-10-17 Thread WgpShashank
@wladimir , its PPT (Pythagoras triplets ) but its number theory based approach http://en.wikipedia.org/wiki/Pythagorean_triple might not be good idea Here is approach : * * *Euclid's formula*[1]http://en.wikipedia.org/wiki/Pythagorean_triple#cite_note-0 is a fundamental formula for

[algogeeks] Please Mention Your Info. Name/Collage/Country and Reason for Joining Algogeek to Minimize Spamming

2011-10-17 Thread WgpShashank
Hey Guys , to Minimize Spamming Maintaining Quality of Group we Need Support from You. Please Mind Above Message. Happy Learning :) Thanks Team Algogeek -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the

Re: [algogeeks] Amazon Question - Find Pythagorean triplet in an unsorted array

2011-10-17 Thread Ankur Garg
@Shashank ..+1 ..I wud say he must be given a tuning award :D :D for solving such eternal conundrum ;) On Mon, Oct 17, 2011 at 2:37 PM, WgpShashank shashank7andr...@gmail.comwrote: @wladimir , its PPT (Pythagoras triplets ) but its number theory based approach

[algogeeks] Please Mention Your Info. Name/Collage/Country and Reason for Joining Algogeek to Minimize Spamming

2011-10-17 Thread sravanreddy001
Wee are already members.. What is expected from us.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/vMtV3ewVYSgJ. To post to this group, send email to

Re: [algogeeks] Please Mention Your Info. Name/Collage/Country and Reason for Joining Algogeek to Minimize Spamming

2011-10-17 Thread chirag ahuja
This is insane!!! You, whatever is your name, are spamming by posting such idiotic things! On Mon, Oct 17, 2011 at 2:47 PM, WgpShashank shashank7andr...@gmail.comwrote: Hey Guys , to Minimize Spamming Maintaining Quality of Group we Need Support from You. Please Mind Above Message.

Re: [algogeeks] Please Mention Your Info. Name/Collage/Country and Reason for Joining Algogeek to Minimize Spamming

2011-10-17 Thread sunny agrawal
if(you are a member already) No need to post anything, just ignore the post :) On Mon, Oct 17, 2011 at 5:38 PM, sravanreddy001 sravanreddy...@gmail.comwrote: Wee are already members.. What is expected from us.. -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Please Mention Your Info. Name/Collage/Country and Reason for Joining Algogeek to Minimize Spamming

2011-10-17 Thread shady
that was by mistake... ignore the thread :D On Mon, Oct 17, 2011 at 3:51 PM, chirag ahuja sparkle.chi...@gmail.comwrote: This is insane!!! You, whatever is your name, are spamming by posting such idiotic things! On Mon, Oct 17, 2011 at 2:47 PM, WgpShashank

[algogeeks] Re: Sorting a array which is already sorted but has some disorder

2011-10-17 Thread Don
Insertion sort is pretty good for this. I've seen a case where we were maintaining a list of items sorted by rank. The ranks changed occasionally, but usually only by +/- 5 at the most, in a list of several million. Insertion sort was much faster at putting them back in order compared to

[algogeeks] Re: Code it...

2011-10-17 Thread Don
Could be done by a self-modifying program. Don On Oct 15, 5:26 am, kumar raja rajkumar.cs...@gmail.com wrote: you have to write a program which tell about how many times it has run. ex: if you run first time it will print 1. if you run second time it will print 2. like this. -- Regards

[algogeeks] Re: print vertical sums of a binary tree

2011-10-17 Thread Navneet
I have an alternate method. At every level, maintain records with (x-axis value, nodeValue) and keep them in a queue. After traversal is done, you can sort the elements based on x-Axis value and sum up the nodeValue for records having same x-axis value. But complexity is becoming O(nlogn)

[algogeeks] Re: Inplace Array Convertion

2011-10-17 Thread Navneet
Great explanation Sunny. But with this approach, won't a single pass suffice? Select a card , find it's new position, insert the card at that position, initialize i to the position of the replaced card repeat till all cards have been processed. The thing we need to remember is whether relative

[algogeeks] Re: Inplace Array Convertion

2011-10-17 Thread Dan
I have a hard copy of the book (years back, I implemented a fortran version of the algorithm described in the book). I don't know if you can find an online version or not. I'm sure there is stuff there. Have you done a simple Google search for in place reorder array ?? It's not a difficult

[algogeeks] K-best assignment problem

2011-10-17 Thread Don
Given a cost matrix with N columns and M rows such that M=N, find the K lowest total cost ways to select one item from each column, with the restriction that only one item may be selected from any row. Don -- You received this message because you are subscribed to the Google Groups Algorithm

[algogeeks] Re: Inplace Array Convertion

2011-10-17 Thread Ankuj Gupta
Is the indexing correct ? For eg a1,a2,a3,b1,b2,b3,c1,c2,c3 for a2 the correct position is 3 but acc to the given formula it is 2. On Oct 17, 9:35 pm, Navneet navneetn...@gmail.com wrote: Great explanation Sunny. But with this approach, won't a single pass suffice? Select a card , find it's

[algogeeks] Re: Google Interview Question

2011-10-17 Thread Navneet
How was your interview? Can you please share the questions for benefit of others? On Oct 1, 3:37 pm, Siddhartha Banerjee thefourrup...@gmail.com wrote: lol!!! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

[algogeeks] Re: Sorting a array which is already sorted but has some disorder

2011-10-17 Thread sravanreddy001
Yes.. And the reason is best case of insertion sort is in the order of n. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/_OJfijjiFVoJ. To post to this

Re: [algogeeks] Re: Sorting a array which is already sorted but has some disorder

2011-10-17 Thread saurabh singh
But still it will depend on the number of distortions.If the number of distortions are large enuf(=n/2) then its better to resort in the most generic case.Even insertion sort would cost o(n^2) in that case. On Tue, Oct 18, 2011 at 3:57 AM, sravanreddy001 sravanreddy...@gmail.comwrote: Yes.. And

[algogeeks] Re: Code it...

2011-10-17 Thread sravanreddy001
@don Do you mean read the source and modify the hard coded value.. This will involve the the compile and linking steps right? Did you mean some thing else? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web

[algogeeks] Re: print vertical sums of a binary tree

2011-10-17 Thread sravanreddy001
I that is what is suggested in the above code. Even here you can avoid the sorting and add all with same x coordinate.. O(n) space as suggested.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

[algogeeks] Reconstruct BST from preorder traversal

2011-10-17 Thread Ankuj Gupta
How to reconstruct a BST from just the prorder traversal of that tree ? -- 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