If the last node of a linked list is connected to the first node, it makes a ring.
Then how would you identify which of the nodes in the linked list is the first node and the last one?
If the last node of a linked list is connected to the first node,
Share
You wouldn’t. If it is a ring, then first and last are meaningless. Any node can be first or last.
If you define “first” as “created first”, then you would probably want to add some sequencing information to the nodes to be able to know that.