Here's your approach for linked nodes:
Define a
Node struct with data and next pointer.
Initialize head and tail to nullptr for an empty list.
For each value to add: allocate a new node with new
Node(value, nullptr).
If list is empty, set head and tail to the new node.
Otherwise, link tail->next to new node, then update tail.
To traverse, loop from head following next pointers.
To free, delete each node while traversing, then set head to nullptr.