Given a sorted (increasing order) array, write an algorithm to create a binary
tree with minimal height.
In this I am not getting is that how we can store binary tree as an array.

Recommended Answers

All 3 Replies

Given a sorted (increasing order) array, write an algorithm to create a binary
tree with minimal height.
In this I am not getting is that how we can store binary tree as an array.

From my understanding on how you wrote this, you need to go from an array to a binary tree.

what you want to say???

It is called a Binary Heap when you are storing it as an array. http://en.wikipedia.org/wiki/Binary_heap (that may not be the best resource, it is a little hard to understand - but start googling "binary heap" and you'll find numerous useful articles).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.