This approach could work, but it becomes less efficient as the number of gaps increase in both frequency and size. More importantly, it is also much trickier to insert a new element or change the order of the elements. I realize that neither insertion nor reordering were specified requirements in the OP, but I was trying to generalize the solution and anticipate future needs*. A linked list would handle those requirements easily.
*I've never been part of a project that hasn't had some degree of feature creep, and this one seems likely. "Oh, good - we can delete pictures. Hey, can we add them, too?"
In reply to Re^3: finding next key in db_file
by bobf
in thread finding next key in db_file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |