Re: [algogeeks] Re: which is the right data structure to use for a given problem ?

2011-12-25 Thread Carol Smith
When two persons have same name and we use one hashtable(HT), what happens inside HT is entirely depends on HT implementation. In this case, HT may chain the values when keys match. When querying the HT for this key, HT returns all the values chained under this key and developer has to iterate and

Re: [algogeeks] Re: Facebook Question

2011-12-23 Thread Carol Smith
@Gene - Cool algorithm! I tried before in java and messed a little to get exact output format. Just wondering how you came up with simple yet working code? -Carol On Thu, Dec 22, 2011 at 6:08 PM, Gene wrote: > The simplest algorithm is probably to check each point against all > others while mai

Re: [algogeeks] Facebook Question

2011-12-21 Thread Carol Smith
@Algoose, in worst case, this is still O(n^2), ain't it? On Wed, Dec 21, 2011 at 12:50 PM, Algoose chase wrote: > Find the distance between each of the points and the origin(0,0) and sort > the points based on this distance. > Also, divide the points based on which quadrant they belong. If the >