Sunday, February 3, 2019

Building a Tree DataStructure in Rust programming language

Building Tree data structure gives more understanding on "Struct" and Box pointers in Rust.

Tree data structure is recurrences of Nodes of same Type where each Node normally will have  "value" field and Pointer pointer to the next node.

This is a little challenging to build the Tree in Rust as Rust won't allow to allocate recurring type as their memory space can not predetermined. But we can use  smart pointer BOX for it.

And implementing methods for the 'Tree' will be interesting.

Please find the problem and solution here in github,

https://github.com/davnav/rustgeeks/blob/master/tree_rust.md




Reference: https://matthias-endler.de/2017/boxes-and-trees/







No comments: