Hey
today I was in a job interview where they gave us a tree with unknown structure(could b not binary) and i was asked to insert it to a database in a certain order where I could turn back the db into tree and show I have done it using ER model, every node in the tree has two data members data1 and data2
can someone answer or give me an hint for how it’s done ?
EDIT: what I wrote is because every child has a father we should add relation between the nodes father and son
because son has onley one father the son has a arrow one to one to his father ‘ i gave for everyy one of them an index and every sun had his father pointer and what does it got to do with the ER model ‘ i dont knoww too this is why i asked it here.
One thing you can do is to label en entire branch with an index (say 1,2,3..) and now the whole branch with a particular index can be taken as a record.
Look over entire tree and try to find some relation between the data and assign some attribute name to every node at each level of that tree.
Now once u have done this you can separate out what those attributes are.. and make an entity which could represent those attributes(or properties).
Now once you your entity is decided you can make an entity and attributes in an ERD(Entity Relationship Diagram)
if you have gone through network model of designing database then you could get some more hint
start thinking from bottom level,then proceed towards the solution,
Good Luck