Note that there are some explanatory texts on larger screens.

plurals
  1. USRatamovic
    primarykey
    data
    text
    plurals
    1. COThank you for this quite complete answer. Your pn_before is a prefix sum such as the ones used in the Fenwick tree as far as I understand, which seems good to me. The only thing I'm not seeing clearly is about insert/delete: with a standard binary search tree, this is easy like you explained (you append the node, update parents prefix sum if on the left branch). This is fine. But, what about a balanced tree (e.g. a Red Black tree or anything else) on which we apply rotations and everything when inserting? Can we easily maintain these properties?
      singulars
    2. COThank you for your answer and pointing me to threaded tree. That's interesting to get "following pages" easily once you find the right "starting page" indeed. But the problem is that I want to query pages not on the internal item Ids (e.g. T140, T150 or anything else) but rather on the Item index in the list. For example in my first example, T120 will be the 21st item (as there is a page P1 of 20 elements). So I want to be able to query an interval [20-29] which should return the elements [T120, ...]. I don't want to search for 120 directly. Hope I'm clear.
      singulars
    3. COThank you for your comment. Actually I'd like to be able to search for a specific interval in a better way than O(length) because as the list of pages grows, the data structure will become linearly slower if I'm not mistaken.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload