Click here to Skip to main content
15,910,471 members
Everything / DataStructures

DataStructures

DataStructures

Great Reads

Latest Articles

All Articles

Sort by Score

DataStructures 

N 22 May 2024 by CPallini
I wouldn't have called the mystack.push(val); inside the delete method of the list. Instead I would have written (in the 'consumer' code) something like int val = mylist.delete(index); mystack.push(val);
N 22 May 2024 by Dave Kreskowiak
Like Richard said, you cannot restore the node you pushed onto the stack because you're losing the position in the linked list where the node came from. To make this work, you would have to create a class that can hold your node instance AND the...
U 21 May 2024 by samcodeonline
I am working on dataStructures and Algorithms. I am currently working on linklist and stack. In linklist i have created the delete method, which is going to remove the node from the linklist but i want to store the deleted node into a stack and...