5 ms·
How do you get the list back in order if there are thousands of entries?
by coding123 6y ago
How do you get the list back in order if there are thousands of entries?
- oconnor663 6y agoIt 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? :)
- pxx 6y agoI 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 https://en.wikipedia.org/wiki/Unrolled_linked_list
- CGamesPlay 6y agoA skip list: https://en.wikipedia.org/wiki/Skip_list https://en.wikipedia.org/wiki/Skip_list