Re:The surprisingly difficult problem of user-defined order ...
by coding123 on Friday January 15, 2021 @09:10PM
(#25799273)
How do you get the list back in order if there are thousands of entries?
[ Parent
| on HN ]
Re:The surprisingly difficult problem of user-defined order ...
by oconnor663 on Friday January 15, 2021 @09:53PM
(#25799557)
It seems like you're in one of two situations: (1) you want the entire list, or (2) you want a small "page" of entries in the list, starting from a known point. For (1), you can fetch all of the entries in table order, whatever that may be, and then figure out the list order after you have the entries. For (2), you make the database do seeks for you in a loop, but it's not such a big deal because it's a small number of them.
I guess the worst case is where you want to iterate over a large dataset in list order, but either you can't fit it in memory, or you don't want it all to go over the wire. In that case...yeah I don't know...what's the linked list equivalent of a B-tree? :)
Re:The surprisingly difficult problem of user-defined order ...
by pxx on Friday January 15, 2021 @10:05PM
(#25799632)
I don't think a linked list that stores multiple elements really gets its own special name (beyond "unrolled") but you can read more about implementation considerations at https://en.wikipedia.org/wiki/Unrolled_linked_list
Re:The surprisingly difficult problem of user-defined order ...
by CGamesPlay on Saturday January 16, 2021 @01:32AM
(#25800542)
A skip list: https://en.wikipedia.org/wiki/Skip_list