Avatar of Steven Ni
Steven Ni
 asked on

How to traverse a tree(input) and build another tree based on the certain condition?

If the file system is the input tree, what I would like to do is to start from one folder, and scan each file within this folder and use the file name to search another place in the file system using some conditions like: filename = foldername, for each foldetname returned in this search, add this foldetname as a child to the output tree and search again until not more match.


So the input is a tree and output is also a tree. Recursion is what I think is required to solved the problem and hopefully someone can share ideas or examples or links , really appreciate!
AlgorithmsProgramming TheoryProgramming

Avatar of undefined
Last Comment
Steven Ni

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
dpearson

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Steven Ni

ASKER
Thanks for the solution and sorry for the late reply as was on vacation.
Your help has saved me hundreds of hours of internet surfing.
fblack61