Hi,
I have a recursive function that is designed to take parse a tree and store all the values of the tree nodes in an NSString.
Is the algorithm below correct?
NSString* finalString = [self parseTree:rootNode string:@""];
-(NSString*)parseTree:(Node*)currentNode string:(NSMutableString*)myString
{
[myString appendText:currentNode.value];
for(int i=0;i<[currentNode.children length];i++){
return [self parseTree:[currentNode.children] objectAtIndex:i] string:myString];
}
}