Skip to content

Tree Algorithm, Recursion, and Printing Example with Folder Parent-Child Relationships. Traverse a tree with recursion.

Notifications You must be signed in to change notification settings

kathleenwest/TreeParentChildTraverseRecursion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tree Algorithm - Parent Child Folder Relationship - Traverse a Tree with Recursion

Tree Algorithm, Recursion, and Printing Example with Folder Parent-Child Relationships

A simple console application that generates a static list of Folder objects randomly ordered.

The Folder objects have a name (string) and relationship to a parent Folder object by reference. Top-level folders have a "null" relationship with their parent Folder.

The application then uses a Tree algorithm to recursively navigate the list of folders and "pretty" print them with tab-delimited formatting based on their level in the hierarchy.

Example:

        1
            1.1
                1.1.1
                1.1.2
                1.1.3
            1.2
                1.2.1
                1.2.2
                    1.2.2.1
                    1.2.2.2
        2
            2.1

Releases

No releases published

Packages

No packages published

Languages