
Native binary tree data structure
Native binary tree data structure
We have lists, maps, and arrays. Now all we need are binary trees. 

Re: Native binary tree data structure
what is a binary tree?
Re: Native binary tree data structure
Code: Select all
Structure Tree
List Child.Tree()
EndStructure
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: Native binary tree data structure
Searching a binary tree is MUCH faster than stepping through a list. A tree also has several different ways of being iterated, some of which will produce an output which is automatically sorted.STARGÅTE wrote:Code: Select all
Structure Tree List Child.Tree() EndStructure
To be honest, I'd rather see PureBasic provide support for OO programming and do away with the built in data structures completely. They don't want to support OO yet what are PureBasic Lists, Arrays, and Maps? Maybe they're not actual objects underneath but they're certainly not primitives and cannot be treated as such.
I wrote my own linked list before they were supported in PB structures. I suppose I'll have to do the same for trees. But working with them in this way can be extremely cumbersome. PureBasic would benefit from the addition of pass-by-reference:
http://www.purebasic.fr/english/viewtop ... =3&t=36923