hi guys,
i should write a code that creates a tree with arbitrary number of children (every child has pointer to its parent), to support insert a node. is this okay?
Please note that this is not a homework site. We won't do your homework for you. The purpose of homework is that you learn by doing. However we are always willing to help solve problems you encountered, correct mistakes you made in your code and answer your questions.
We didn't see your attempts to solve this problem yourself and so we cannot correct mistakes you didn't made and answer questions you didn't ask. To get help you should do something yourself and get real problems with something. If your problem is "I don't understand a thing", then you should go back to basics and study again.
> i should write a code that creates a tree with arbitrary number of children (every child has
> pointer to its parent), to support insert a node. is this okay?
Why not keep it simple: have a vector of nodes, instead of a vector of pointers to dynamically allocated nodes?
@JLBorges: the parent pointer will become invalid if the vector reallocates
store pointers, reserve enough capacity (¿possible?) or use a container that doesn't reallocate
or use another method to reference the parent, for example a pointer to the container and an index