New update is available. Click here to update.

Posted: 26 Feb, 2021

Difficulty: Easy

```
1. There can be more than one way to convert an array to a height-balanced binary tree. You can find any one of them.
```

```
Consider an array ‘Arr’ = [-10, -5, 2, 4, 5], one way to convert it to a height-balanced binary tree is -:
```

```
Here, You can see that the height of the left and right subtree of the node having the data ‘2’ is 2 and 2 respectively, i.e both are the same, and the height of the left and the right tree of the node having the data ‘-10’, is 0, 1 respectively, i.e differ by only 1, and the height of left and right subtree of the node having the data ‘4’, is also 0 and ‘1’ respectively, i.e differ by only ‘1’. Thus this binary search tree is height-balanced. Also, note that this is not the only way to convert this array to a height-balanced binary search tree.
```

SIMILAR PROBLEMS

Best time to buy and sell stock

Posted: 2 Sep, 2022

Difficulty: Moderate

Best time to buy and sell stock II

Posted: 5 Sep, 2022

Difficulty: Moderate

Ninja And The Class Room

Posted: 19 Sep, 2022

Difficulty: Easy

Array Rotation

Posted: 21 Oct, 2022

Difficulty: Easy

Find The Single Element

Posted: 30 Oct, 2022

Difficulty: Easy

Categories:

Popular Courses: