How many nodes does a leftist tree with r nodes must have?

Category: QuestionsHow many nodes does a leftist tree with r nodes must have?
Editor">Editor Staff asked 5 months ago

How many nodes does a leftist tree with r nodes must have?
 
(a) 2^r
 
(b) 2^r-1
 
(c) 2r
 
(d) 2r-1
 
My doubt is from Heap in section Heap of Data Structures & Algorithms I
 
I got this question in an interview.

1 Answers
Editor">Editor Staff answered 5 months ago

Correct answer is (b) 2^r-1
 
The best explanation: A leftist tree with r nodes on the right path is proved to have at least 2^r-1 nodes. This theorem is proved by induction.


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: 40701