Algorithm for converting hierarchical flat data (w/ ParentID) into sorted flat list w/ indentation l
- by eagle
I have the following structure:
MyClass {
guid ID
guid ParentID
string Name
}
I'd like to create an array which contains the elements in the order they should be displayed in a hierarchy (e.g. according to their "left" values), as well as a hash which maps the guid to the indentation level.
For example:
ID Name ParentID…