Skip to content

Add real-time versions? #38

@treeowl

Description

@treeowl

I'm really not sure it's worth the trouble, but we could improve the amortized times to worst-case using scheduling. Okasaki's scheme uses a separate schedule, which doesn't seem terribly compact, and his analysis is rather tricky. I think we can do something a bit simpler. The debit invariant allows one debit on the child of a Skip node, and no debits anywhere else. We can arrange to force a node as soon as its parent changes from a Skip to a Cons. To accomplish that, we can arrange to always have access to the first Skip node by linking them together.

data Scheduled rk a = forall xxrk x. Scheduled !(BinomForest rk a) (BinomForest xxrk x)
data BinomForest rk a
   = Nil
     -- The second field points to the next Skip node, or Nil if there is none.
   | forall xxrk x. Skip (BinomForest (Succ rk) a) (BinomForest xxrk x)
   | Cons {-# UNPACK #-} !(BinomTree rk a) !(BinomForest (Succ rk) a)

This gives a somewhat segmented flavor. Another option, of course, might be to use a segmented number system. Doing that with nested types will require type-aligned (nonempty) lists; I'm not sure how complicated it will get. And then there are also skew binomial heaps, which I don't really understand yet.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions