If you have to implement a phone book of 10 millin people in NYC, what
data structure would you use and why ?
Show the implementation if HashTable or Binary Trees?
Thanks,
Raj
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
By expanding both log (n!) and n log n
log (n!) = log n + log (n-1) + .. + log 2 + log 1, n
terms here
n log n = log n + log n + .. + log n + log n, and n
terms here
n log n*>*log (n!), n > 1
n log n=log (n!)
On 11/7/07, anvera <[EMAIL PROTECTED]> wrote:
>
>
> Why not? Does order really matters here? Look at the symmetry of the
> problem. Put 3,4,5,5 and then 4,5,6,7 at the right side. Look at the
> solutions. How they differ? Is this natural?
Though the order is not imp you cant tell which 2 variable
sort the sums, call them s1, s2, s3,..., satisfy s1 <= s2 <= s3 <=
and set the n integers by a1, a2, a3, satisfy a1 <= a2 <= a3 <=
so we can sure that s1 = a1 + a2, and s2 = a1 + a3, and what is a2 + a3?
only a1 + a4, a1 + a5, ..., a1 + an can less than a2 + a3, so a2 + a3 is one
of s3, s4, ...
Why not? Does order really matters here? Look at the symmetry of the
problem. Put 3,4,5,5 and then 4,5,6,7 at the right side. Look at the
solutions. How they differ? Is this natural?
On Nov 7, 6:55 pm, Andrey <[EMAIL PROTECTED]> wrote:
> Won't work.
> You just can't build such a system, because y
Won't work.
You just can't build such a system, because you don't know in which
order values should appear in right part of system. Say, we have the
follwing input of 6 numbers: 3, 4, 5, 5, 6, 7 and we are supposed to
find 4 values (4 * (4 - 1) / 2 = 6) x1, x2, x3, x4
What the system will look
check out :
http://groups.google.co.in/group/programming-challenges/browse_thread/thread/f9e5436fbc6dbc56?hl=en
#
On 11/7/07, anvera <[EMAIL PROTECTED]> wrote:
>
>
> I have not developed entirely the idea, but I am sure it works.
> Just write the corresponding linear system. You will have n unk
I have not developed entirely the idea, but I am sure it works.
Just write the corresponding linear system. You will have n unknowns
and n(n-1)/2 equations. Provided that the system is consistent you can
find a solution by Gaussian elimination.
For the complexity, you can do it in less than n^3/3
http://www.freewebs.com/homebusiness1
--~--~-~--~~~---~--~~
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
http://www.moneycosmos.com/?r=321740
--~--~-~--~~~---~--~~
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
Any set of n integers form n(n 1)/2 sums by adding every possible
pair.
The task is to find the n integers given the set of sums.
Any ideas?
I've found out the solution but I doubt it the best one...
--~--~-~--~~~---~--~~
You received this message because you
Any set of n integers form n(n - 1)/2 sums by adding every possible
pair.
The task is to find the n integers given the set of sums.
Any ideas?
I've found out the solution but I doubt it the best one...
--~--~-~--~~~---~--~~
You received this message because you
12 matches
Mail list logo