I have written a simple LinkedList class. I first have a Node class:
class Node
{
public:
Node* next;
int value;
Node(int val)
{
value = val;
next = NULL;
}
Node(int val, Node* y)
{
value = val;
next = y;
}
}
then implementation for LinkedList is straightforward, with a Node* head member and a addNode(int value) member function.
What are other methods to implement a linked list? could give other such implementations or hint at relevant doc?
Thanks and regards.
The standard library defines a doubly-linked list implementation you can use (see here, for example). I’d advise using that unless you have a very good reason not to.