1) a list of strings. These strings are related to each other as parent and children.
For e.g, if my list contains a,b,c,d, then a is parent of c and b, c is parent of d.
each child can have only one parent.
I need to write logic to pass this list in an iterator and keep finding the parents till the root(in e.g. it is a) and in each iteration i need to check for an attribute of the parent(by passing parent in some xyz method).
Please let me know how i could implement this logic.
It is difficult to understand for your description to know exactly what you need, I am afraid. It sounds as though you are trying to create a parse tree from different tokens in your String.
Get a pencil and paper and write out what you require: structure before and structure after. It appears each token acts as a binary operator in prefix notation. Have a look at my post about parse trees and arities of operators only that was in postfix, so it is slightly different.
Then write down what you plan to implement (not what you would like us to implement ) and let us see what we think of it.
But I still think that understanding the basic concept is the most important part of the process.