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 8620951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:42:17+00:00 2026-06-12T06:42:17+00:00

I am working through Algorithms in C++ by Robert Sedgewick and came across the

  • 0

I am working through Algorithms in C++ by Robert Sedgewick and came across the following statement:

The height of a binary tree with N internal nodes is at least lg N
and at most N-1. The best case occurs in a balanced tree with 2^i
internal nodes at every level except possibly the bottom level. If the
height is “h” then we must have

         2^(h-1) < N+1 <= 2^h

since there are N+1 external nodes.

There wasn’t much explanation surrounding the inequality, so my question is: how did the author deduce the inequality and what is it showing exactly?

Thanks!

  • 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-12T06:42:19+00:00Added an answer on June 12, 2026 at 6:42 am

    The inequality 2^(h-1) < N + 1 <= 2^h demonstrates that, for a given height h, there is a range of node quantities that will have h as a minimum height in common. This is indicative of the property: all binary trees containing N nodes will have a height of at least log(N) rounded up to the next integer.

    For example, a tree with either 4, 5, 6 or 7 nodes can have at best a minimum height of 3. One less than this range, and you can have a tree of height 2; one more and the best you can do is a height of 4.
    If we map out the minimum height for a tree that grows from 3 nodes to 8 nodes using the base 2 logarithms for N and round up, the inequality becomes clear:

    log(3) = 1.58 -> 2  [lower bound]
    
    log(4) = 2    -> 3  [2^(h-1)]
    log(5) = 2.32 -> 3
    log(6) = 2.58 -> 3
    log(7) = 2.81 -> 3
    
    log(8) = 3    -> 4  [2^h | upper bound]
    

    It might be useful to notice that the range (made up of N+1 different quantities) is directly related to the number of external nodes for a given tree. Take a tree with 3 nodes and having a height of 2:

         *
        / \
       *   *
    

    add one node to this tree,

        *          *          *          *
       / \        / \        / \        / \
      *   *  or  *   *  or  *   *  or  *   *
     /            \            /            \
    *              *          *              *
    

    and regardless of where you place it, the height will increase by 1. We can then keep creating leaf nodes without changing the height until the tree contains 7 nodes in total, at which point, any further additions will increase the minimum possible height once more:

        *
       / \
      *   *
     / \ / \
    *  * *  *
    

    Originally, N was equal to 3 nodes, which meant N+1 = 4 and we saw that there were 4 quantities that had a common minimum height.

    If you need more information, I suggest you look up the properties of complete and balanced binary trees.

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

Sidebar

Related Questions

I am currently working through a book on algorithm design and came across a
I am working through the Introduction to Algorithms book by Cormen, and I have
I've been working through the following example of the details of the Markov Clustering
I'm working through an algorithm problem set which poses the following question: Determine if
Still working through JQuery to get data and repopulate portions of a page. Right
In working through the issues with another question, I've found text files with embedded
I am working through the EditableGrid demos modifying the code to understand it and
I'm working through some android tutorials right now in preparation for a two week
I'm working through the Demo: Binding Data with the SqlDataSource of this pluralsight video
I am working through the tutorials on writing custom spring namespace handlers found here:

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.