Treap with implicit keys

后端 未结 4 556
滥情空心
滥情空心 2020-12-15 10:10

There\'s a data structure called treap: that\'s a randomized binary search tree, which is also a heap on randomly generated so-called \"priorities\".

There\'s a vari

4条回答
  •  感情败类
    2020-12-15 10:48

    The key idea (no pun intended!) in treaps is to use keys, which are randomized. If you remove the keys, I don't see how you can have a treap: so perhaps I misunderstood your question. Or perhaps you are referring to the alternative to treaps, the randomized binary search tree. Both data structures use the same idea that you can attain average-case complexity by making sure your tree looks like an average tree (instead of a pathological case).

    With the treaps, you do this using random priorities and balancing.

    With randomized binary trees, the randomness is solely included during the construction: that is, when you insert a node in tree T, it has probability 1/(size(T) + 1) to be at the root, where size(T) is the number of nodes of T; and of course if the node is not inserted at the root, you continue recursively until it is added. (See articles my C. Martinez for a detailed study of these trees.)

    This data structure behaves exactly like a treap, but uses a different mechanism that does not require keys.

    If this is not what you were looking for, perhaps you could share some additional information: did your lecturer mention anybody who might have worked on this structure, where did you here this lecturer and what his/your nationality. It might not seem like it, but knowing your native tongue could be an important clue as you can generally peg down algorithms/data structures to a specific country that originated it.

提交回复
热议问题