Hi,
Use hashing, but with perfect hashing which does all these operations in
O(1).
Refer to Introduction to Algorithms by CLRS to learn about perfect hashing.
--
Merge pairs of rows until u get a single row, while merging remove the
duplicates
--
How is it a huge improvement? Your O(SN) is the same time as the dynamic
programming solution for 0-1 knapsack isn't it?
On 8 January 2013 14:44, Don dondod...@gmail.com wrote:
Yes, that is true. However, trying to find the optimal partition is
equivalent to the 0-1 knapsack problem, which is
My solution is equivalent to using DP for the 0-1 knapsack, but the DP
approach does not identify the partition, it only determines if it
exists. In the same way, my solution does not determine which numbers
to make negative. It only determines what the smallest possible sum
is. The DP approach to
I don't think that perfect hashing provides nthentry in constant
time.
You could store items in a vector indexed by the order in which they
were inserted. Retrieving an item would be constant time, but what
happens when you have thousands of items and you need to delete item
27? Now most of the
Hi,
I have understood the solution, but here we are talking about knowing the
path(elements in the subsets in this case).
I saw we could use the back pointer technique, which I understood, but I'm
not able to see how would I code this technique.
Please try to explain me this thing.
Thanks a lot