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

  • Home
  • SEARCH
  • 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 7445899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:09:53+00:00 2026-05-29T12:09:53+00:00

Given the following sorted integers: 1 2 3 4 5 6 7 8. How

  • 0

Given the following sorted integers: 1 2 3 4 5 6 7 8. How would you construct a balanced search tree?

I would really appreciate if somebody could explain with without giving code examples.

It is not homework. I’m doing a revision for an exam.

If the values above are put into a balanced tree, should the tree look similar to following?

        5
      4   6
    3      7
   2        8
 1
  • 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-05-29T12:09:54+00:00Added an answer on May 29, 2026 at 12:09 pm

    You can think on building the from bottom up.

    You will have a root. If there is only one element in the tree this is the root. Each element in the root will have a reference to another two node in the tree (binary tree). One for a element bigger than itself and another for a element smaller than itself.

    So if you tree has only the number one and you are going to insert number tow, this will be inserted as a leaf, and the reference “bigger than” in the root will point to node 2.

    When you insert the value 3 you will have to insert it in the reference “bigger than” of the node 2. But wait, this will make the tree to be unbalanced so you have to correct this. You will have to set the node 2 as the root and point to the node 1 in the “smaller than” and the number three in the “bigger than” reference.

    Hope this make you understand it a little better.

    The final result depends on the order you insert the elements. But if you insert like 1, 2, 3, 4, 5… The tree should be something like:

      2
    1   3
    

    then

        3
      2   4
    1
    

    and after

        3
      2   4
    1       5
    

    and so on. The example when inserting the nodes like this is not so good but if you think in the order: 4, 2, 6, 1, 3, 5 then the result should be something like this:

           4
      2        6
    1   3    5   
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given a sorted array of n integers, like the following: ary = [3, 5,
Given a sorted vector with a number of values, as in the following example:
Given the following: List<List<Option>> optionLists; what would be a quick way to determine the
Given the following: &row->count Would &(row->count) be evaluated or (&row)->count be evaluated in C++?
We want to search for a given element in a circular sorted array in
You are given two sorted integer arrays, which have some common integers. Any common
Simple question - given an IList<T> how do you perform a binary search without
Given the following I would like to keep the currently selected item selected on
I have three tables... Given the following tables I would like to know how
I need the following functionality Given two sorted lists, merge them I have this

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.