[algogeeks] Re: Looking for a comparative shopping agent algorithm that takes shipping into account

2006-06-09 Thread C Erler
This appears to be a nonlinear programming problem. I haven't studied NLP, so I don't know if there are any decent algorithms for this sort of thing. Here is a not-completely-inefficient algorithm : Find the best deal for the last card in your list, ignoring shipping costs. Find the best deal

[algogeeks] Re: Finding common elements

2006-05-30 Thread C Erler
Can you use some sort of hash table to store all elements of the first list, then check whether it contains each element of the second ? This might be O(n) in most cases. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

[algogeeks] Re: Finding common elements

2006-05-30 Thread C Erler
Your replies indicate a misunderstanding of asymptotic notation. If you do several things in a row, to get the asymptotic performance, you take the worst performer's speed and use that. For instance, with the hash, you do several things in a row : Create the hash: O(n) Fill the hash: O(n)

[algogeeks] Re: programming pearls duplicate value

2006-05-29 Thread C Erler
Because there are infinite integers, there is no need for a list of 4,300,000,000 of them to contain a duplicate. If there are 4,299,999,999 choices, there will be one duplicate. Because the solution uses binary search, the list is sorted. So, the full problem is probably something like the

[algogeeks] Re: [ counting sort ideea ]

2005-11-26 Thread C Erler
Radix sort.