On Friday, May 10, 2019 at 8:39:08 PM UTC+1, ian wrote: > > > Two thoughts on this: > > 1. For something like a photo album, it seems unlikely to me that a > single album would get so big that having to shift everything down > would actually be a problem. >
This is almost certainly true. :) But it also seems like a good opportunity to check whether there's a simple-ish general solution. > 2. If you do want to improve the asymptotics, you could basically > construct a trie using the names; something like the following: > > On initial import, use keys like: > > photo-0 > photo-1 > photo-2 > ... > > On subsequent imports, if you have something that's supposed to go > between photo-0 and photo 1, you could rename photo-1 to photo-11, > and name the new image photo-10. > > You could fiddle with the details of the scheme a bit, but it gives you > logarithmic insert, instead of linear. > Yeah, I like this idea. To put something between photo-0 and photo-1, you might be able to just give it the name photo-01 without renaming others, which would be constant insert? (I think the only time you couldn't do it this way would be to insert something at the front of the list.) > Still feels like a bit of a hack though, so maybe still worth > investigating other solutions. This problem feels similar to the list labelling problem, so perhaps there are ideas to explore there. https://en.wikipedia.org/wiki/Order-maintenance_problem#List-labeling -- You received this message because you are subscribed to the Google Groups "Perkeep" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/perkeep/c5b5c2df-b519-4fed-8cad-cc3c29ed3cef%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
