+1 vote
in Data Structures & Algorithms I by (110k points)
What is the condition for priority of a node in a treap?

(a) a node’s priority should be greater than its parent

(b) a node’s priority should be at least as large as its parent

(c) the priority is randomly assigned and can have any value

(d) a node’s priority is always given in decreasing order

This interesting question is from Binary Trees topic in chapter Binary Trees of Data Structures & Algorithms I

The question was asked at a job interview.

1 Answer

+1 vote
by (672k points)
selected by
 
Best answer
Right choice is (b) a node’s priority should be at least as large as its parent

Best explanation: A node’s priority should satisfy heap order. That is, any node’s priority should be at least as large as its parent.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.

Categories

...