Hi Daniweb community,
I have implemented a node class, DoublyLinkedList class and a SinglyLinkedList class.
For each DoublyLinkedList node created, there is supposed to be a reference to a NEW SinglyLinkedList. Meaning each DLL Node has its own SLL. I have such a reference created which is a single node where I even put into the SLL. The problem being is that every time I add something to the SLL, the reference node gets every single piece of data (and I am only creating one SLL for the entire thing).
Also the number of nodes aren't fixed as they are added over time. I have an idea, which would be indexing each DLL node and creating a SLL to each of them, but was wondering if this community has any more efficient or better ideas.
dlist.create("A", "hyphen"); //creates a doubly linked node with A as a letter index and hyphen as data dlist.insert("A", "he-man"); //insert a singly linked node with A as a letter index and he-man as data dlist.insert("A", "koolaid"); dlist.insert("A", "shortkid"); dlist.create("C", "subtitle"); dlist.insert("C", "gintaman");
Should yield in the linked lists:
Right now, my DLL and SLL are good SEPARATELY. I haven't the slightest clue how to actually have the doubly linked list reference the singly.