Why exactly do we need a “Circular Linked List” (singly or doubly) data structure?

前端 未结 10 1076
無奈伤痛
無奈伤痛 2021-01-30 08:27

Why exactly do we need a \"Circular Linked List\" (singly or doubly) data structure?

What problem does it solve that is evident with simple Linked Lists (singly or doubl

10条回答
  •  时光取名叫无心
    2021-01-30 09:04

    A circular list is simpler than a normal doubly-linked list. Append is just prepend and shift forward once, Pop back is just shift back once and pop front. By tying the two ends together, you get a double-ended list for the cost of just implementing the operations of a one-ended list.

提交回复
热议问题