Thanks to Henry and Raul for your suggestions: I will try them out. Here is the context for the problem. I hope this may spur more suggestions.
In my attempt at the Meteor problem, I represent a placement of a single piece as a bitmap of length 50, stored in a 64-bit integer. A postion on the board is represented as a length 10 array in which the ith element is a bitmap corresponding to piece i, or 0 if that piece has not yet been used. This corresponds to the list a in my problem: it is always of length 10. I want to find the successors of the current position obtained by adding one more piece. To constrain the branching, I consider the first empty cell e of the position, and look for configurations of pieces with first cell e that do not intersect any occupied cells. This can be done quite quickly, using indexing and bitwise operations. The vectors v and i give combinations of piece value and piece index, and these have to be inserted into separate copies of a. The result is a list of successors of position a. These must be further processed (depth first on an explicit stack or recursively to satisfy the rules). The common size of v and i is at most 102, and is often a lot less. If my solution is going to be a contender, I need this step to be fast: it is the bottleneck in my current approach to the problem. I realize I may have to rethink. Any advice or further suggestions would be appreciated. Best wishes, John ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
