Data Structure - Implementing a Tree in Swift
['Benoit Pasquier']
Benoit Pasquier - Swift, Data and more
This example represent a generic tree, each node is labeled with an integer but it’s not sorted, or unique, some has more children nodes than others. Since we represent a Tree by its root node, we’ll need to define a node and the ability to link children to it. let company = Node < String >( "myCompany" ) // we create a structure to represent Engineering team let engineering = Node < String >( "Engineering" ) engineering .