Can a linked list have two pointers, head and tail?

I am not sure if its OK to ask a data structure question in this forum but i am asking anyway as i have no other option.

I am asking this question from the interviewer's perspective.

A linked list normally has only a header pointer e.g. as explained in this tutorial: http://www.studytonight.com/data-structures/linear-linked-list

When i know that i have to repeatedly insert an element at the end of the linked list, is it okay to have a tail pointer in the linked list all the time, just like a head pointer, and keep it updated? Will the data structure still be a linked list? It allows one to get rid of the iterations of entire list every time so why don't people generally use it? or is it common to have a tail pointer?
The data structure which has the head and tail pointers is the linked list container. The linked list itself is different, and is generally not exposed directly through the container's API.
Can you explain what is a link list container or share a link? I don't understand you answer,sorry.
Explain what? I already said the container is what has the head and tail pointers. The list itself doesn't (shouldn't) have head or tail pointers.

See for example C++'s std::list which is a doubly linked list container.
Last edited on
O.K. Thanks.
Topic archived. No new replies allowed.