Now, I know the first thing I am going to be told is that I should add a balance function to my binary tree, well I have asked the group member who created our tree to do it, but he hasn't got back to me yet. So rather than wait and have him possibly come back and say that he can't, I've decided to try and solve the problem myself, without touching his tree.
Ok, I am making a Binary tree which holds 62500 pointers to a height map so that during our game loop we will optimise the data retrieval time than if we just used an array of mesh's. The only problem, is that I create the trees in order, thus entering them into a tree strait away would form a link list, which is as slow as an array, so there would be no point. What I was wondering, is there some sort of algorithm I can run which will choose a mesh and add it to the tree (on creation it is stored in an array, which is slower than a btree, but if we placed into a btree on creation it would be as slow as an array, so there is no point) so that the tree is automatically balanced. I was having a fiddle trying to make my own algorithm, but a month strait uni assignments has fizzled my brain a fair amount...
by auto balance i mean, it will start from the middle, then go to the middle of the middle and the end, then the middle of the new middle and the end, and so on so forth, filling all the the branches so the depth of the tree is minimal
Thanks for the help you guys
Edited 5 Years Ago by falconmick: n/a