Question

How many different heaps are there for an array of a) 6 entries? b) 12 entries?...

How many different heaps are there for an array of a) 6 entries? b) 12 entries? ) 18 entries? Explain your answer.

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

According to your requirement below is the equation through which you can calculate the different heaps for an array.

Equation:

L=2k−1−1+min(2k−1,M)

So, L=2k−1−1+min(2k−1,M)

And for Right Subtrees :

R=2k−1−1+max(0,M−2k−1)

Returning to the original problem you can calculate number of entries for an array as the number of binary heaps with N distinct elements, as

f(0)=1f(0)=1
f(1)=1f(1)=1
f(N)=(N−1L)f(L)f(R)

Add a comment
Know the answer?
Add Answer to:
How many different heaps are there for an array of a) 6 entries? b) 12 entries?...
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