FIND THE ANSWERS

I need to implement a Btree that uses strings instead of integer for it's values?

Answer this question

  • I need to implement a Btree that uses strings instead of integer for it's values?


Answers

Answer #1 | 23/12 2013 06:00
It would be better if you could mention which programming language you are using. Anyways, I haven't done much binary tree, but the way I can think of it is, you can take an array of strings (in C, that would be a 2D character array), then you can think of array[1] as the root. Then you can fill in the rest of the tree like this: For any node array[n], the left child will be array[2n] and the right child will be array[2n+1] Hope that helped. There may be other ways of creating a binary tree. Hopefully someone else can mention any other way that might be easier.

Possible answer