0

binary tree

Hello I have a question that how can I implement binary tree on an array which I know size of it, I mean that the function prototype is : struct* binarytree(int Arr[],int sizeArr); what is the code?

15th Dec 2018, 6:11 AM
Matin Zamani
Matin Zamani - avatar
3 Respostas
+ 3
Hello, 😊 --> what is the code!? Please, Use the search feature before posting as to reduce the number of duplicate threads in Q/A section!👍 https://www.sololearn.com/post/10362/?ref=app https://www.sololearn.com/learn/322/?ref=app
15th Dec 2018, 6:27 AM
Danijel Ivanović
Danijel Ivanović - avatar
0
You can use this method : The sons of each node (placed at index i in the array) is of index 2*i for the left son and 2*i + 1 for the right son All you have left is to find a way to know when you reach a leave (do array of pointers ? A specific value forbidden elsewhere ?)
15th Dec 2018, 3:56 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
hello
27th Aug 2021, 8:40 PM
Adnan Mahmud
Adnan Mahmud - avatar