What is the priority of a null node?

Category: QuestionsWhat is the priority of a null node?
Editor">Editor Staff asked 1 month ago

What is the priority of a null node?
 
(a) 1
 
(b) 0
 
(c) random number
 
(d) infinity
 
My doubt is from Binary Trees in division Binary Trees of Data Structures & Algorithms I
 
I got this question in an online quiz.

1 Answers
Editor">Editor Staff answered 1 month ago

The correct answer is (d) infinity
 
Easiest explanation – The priority of a null node is set to be infinity in a treap so that during deletion, priority of that particular node is set to infinity, rotated and freed.