I have a Object that contains an ArrayList of self referntial objects. Each Object in that ArrayList contains the same structre upto n degrees. Now i have to search for a string in the structure and if found i have to print all the way up to the root. Here is a sample
MyClass {
string name;
ArrayList<MyClass> subClasses;
}
What data structure would be best to do this. Or do i not need one to use it.
Kind Regards