Thread overview | |||||
---|---|---|---|---|---|
|
June 02, 2020 Is this a good tree? | ||||
---|---|---|---|---|
| ||||
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. |
June 02, 2020 Re: Is this a good tree? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimirs Nordholm | 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. |
June 02, 2020 Re: Is this a good tree? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Q. Schroll | On Tuesday, 2 June 2020 at 12:34:53 UTC, Q. Schroll wrote:
> On Tuesday, 2 June 2020 at 11:44:10 UTC, Vladimirs Nordholm wrote:
>> [...]
>
> You might want to check out this: https://en.wikipedia.org/wiki/Trie
>
> Possibly, that's exactly what you're looking for.
Thank you!
I believe this is exactly what I need ;)
|
Copyright © 1999-2021 by the D Language Foundation