Is this a good tree?

Q. Schroll qs.il.paperinik at gmail.com
Tue Jun 2 12:34:53 UTC 2020


On Tuesday, 2 June 2020 at 11:44:10 UTC, Vladimirs Nordholm wrote:
> Hello.
>
> I want to create a tree which maps sequences of numbers to 
> data. ex:
> - [1, 2]    -> 1
> - [1, 3, 1] -> 2
> - [1, 3, 2] -> 3
>
> I have no prior knowledge of what makes a good tree, and I am 
> unsure if what I've got is good. I mean it works, but if anyone 
> with more knowledge of trees or D-lang would mind giving some 
> feedback I would be more than happy.
>
> I've made a scaled-down, "in essence", runnable example of what 
> I have here: https://run.dlang.io/is/JI8T2T
>
> For more context, my actual code (with extra boilerplate + 
> project specific things) can be found here: 
> https://github.com/vladdeSV/scone/blob/develop/source/scone/os/posix/input/input_tree.d
>
> Once again, any feedback is greatly appreciated.

You might want to check out this: 
https://en.wikipedia.org/wiki/Trie

Possibly, that's exactly what you're looking for.


More information about the Digitalmars-d-learn mailing list