I would like to check the answer of this exercise:

A circular doubled linked list with N elements has pointers that cost k bytes each of space in memory. How many bytes do the pointers of this list cost in total?

Researching about circular linked lists, i can assume that each node has 2 pointers. So am i right to say that the answer is 2(n)k bytes?

Thanks.

• It totally depends on your implementation. If you have a singly linked list as circular list then you have only n pointers. – Navjot Singh Sep 30 '18 at 22:16
• It is double linked circular list – heresthebuzz Sep 30 '18 at 22:18
• What is question actually asking. It is hard to understand. At first place it says that all pointers take k bytes and then it asks for the same thing – Navjot Singh Sep 30 '18 at 22:19
• Its asking how many bytes does it cost – heresthebuzz Sep 30 '18 at 22:20
• It means that a single pointer takes k bytes – heresthebuzz Sep 30 '18 at 22:21

The list takes $$2*N*k$$ bytes in total. A circular linked list is just a simple linked list with its last node's next pointer pointing back towards head. So, no extra pointer is required to make it circular. Hence, the total space is $$2*N*k$$.