Hi.. Friends,
I have a Table where Parent Child Relation ship is stored as:
ChildID Name ParentID
1 A1 Null
2 A2 1
3 B1 Null
4 A3 2
5 A4 1
I m Woking on Objective C and I need to Generate a text File in Manner:
Name =A1>
Name =A2>
Name =A3/>
Name =A2/>
Name =A4/>
Name =B1/>
I was using a approch where I catch the Last Element (Id=5) first and then checking all other nodes to get its Parent Nodes. n Complexity comes to be as n*n-1, Is there any other better approach as this approach is not a succes when we have lasrge data in Database.
Database Structure is flexible, we can change that, if there is something better...
Looking for your help and support.