Question

1. A non-empty heap has n nodes. How many interior modes does it have? 2. A...

1. A non-empty heap has n nodes. How many interior modes does it have?

2. A non-empty tree has n > 1 nodes. How many of them are interior nodes?

3. A non-empty heap has L leaves. How many nodes does it have?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1) It can vary, from 1 to (n-1).

  • in case if there are only two elements in heap internal node will be only 1
  • in case if there are n elements and they are like 1, 2, 3, 4, 5.. so on. Then heap will be similiar to a linear tree,  then number of internal node will be (n-1).  

2) Again it will vary and follow the same concept as part 1.

3) If a heap have L leaves then, it can have internal node between (L) to (n-1) as number of internal nodes. where n is total number of nodes in heap.

Add a comment
Know the answer?
Add Answer to:
1. A non-empty heap has n nodes. How many interior modes does it have? 2. A...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT