linked list question
I was looking for help in a linked list problem I am having in C++. I wanted to create a linked list that contains a node that references a dataObject and also references another linked list. This allows for a a linked list that can extend infinitely at every node. Does anyone
have any sugestions or source code that pertains to this- or even another datastucture that can serve the same purpose.
My problem with coding it is, that my linked list includes a node which includes a dataobject and another linkedlist(itself). This gives me an error. There must be a way around this.
a list can be an object just like any other. The implementation of the algorhythm you are proposing sounds like a list of lists, so yeah I think it is possible, but it might not be straightforward, and I've never tried it.
make a array of pointers (Ex: int **array;) then allocate the pointer (Ex: array=new int*;) this will make a array of pointers to a array of pointers(i hope you understand its a tuff subject) you dont have to use the "7" it could be a varable taken from the user. the you need to make the arrays that the pointer arry points to like this:
this will make the 7 array point to a array of 5. I think you can make it a linked list instead of the array 5 youll have to play with that. hope this helps. Good luck.