What is the priority of a null node?

Category: QuestionsWhat is the priority of a null node?
Editor">Editor Staff asked 5 months 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 5 months 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.


Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17
Articles: 40702