Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8341253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:25:28+00:00 2026-06-09T05:25:28+00:00

Given the integers from 1 to n, determine how many valid binary heaps can

  • 0

Given the integers from 1 to n, determine how many valid binary heaps can be constructed with these numbers.

Example: 1 2 3 4

valid min heaps are: {1 2 3 4}, {1 3 2 4}, {1 2 4 3},

Thus the answer is 3

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T05:25:30+00:00Added an answer on June 9, 2026 at 5:25 am

    hint:

    A binary heap has a predefined number of nodes, and a well defined structure (Complete tree)

    Think recursively about this problem.

    “Chose” which of the non-root numbers go to the left subtree, and which to the right – and recursively invoke on the subtrees.

    f(1) = 1 //no sons
    f(2) = f(1) * 1 //one son and a root
    //chose which element will go to the left sub-tree, and recursively invoke.
    f(3) = Chose(2,1)* f(1) * f(1) * 1 
    f(4) = Chose(3,2)*f(2) * f(1) * 1 //chose which 2 elements will go to the left sub tree
    ...
    

    The question is tagged as homework, so I am leaving finding the exact numbers for the general case up to you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given a start date, how can I determine how many business weeks it's been
Take the following problem: how many numbers are in a given range of integers,
This problem is taken from interviewstreet.com Given array of integers Y=y1,...,yn, we have n
Is it possible in MySQL to select from a static set of integers? Given
Given two vectors of integers, how to determinate if there's some element from 1st
Suppose I am given: A range of integers iRange (i.e. from 1 up to
Possible Duplicate: Rolling median algorithm in C Given that integers are read from a
Question from Programming Pearls, 2nd edition: Given a sequential file containing 4,300,000,000 32-bit integers,
Given are a number of finite sets of integers, for example: A = {1,2,3}
Working in Python, given a list of N sets of integers from the range

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.