![]() I've also tried playing around with set bit counts, but I've found no meaningful results. The sub-optimal overhead gets bigger as the list size increases. ![]() For a list with 250 items where the correct solution is 14, the average size computed by greedy merging is about 30 (varies from 20 to 70). The greedy approach is usually misleading in similar cases and so it is for this problem, but I can't find a simple counterexample that'd lead to a correct solution. ![]() In other words, if two values of two triplets are equal, remove these two triplets, bitwise OR the third values and place the result to the collection. For two triplets (A, B, C) and (A', B', C'), remove the original triplets and place the triplet (A | A', B, C) if B = B' and C = C', where | is bitwise OR.To do this, we're provided a simple rule that allows us to merge the triplets : The goal is to minimize the size of the collection. The value stored inside can be big, so generally it's impossible to create an array of size A, B, or C. I've got a collection of triplets of integers - let's call these integers A, B, C. I'm trying to come up with an algorithm for the following problem :
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |