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

前端 未结 10 1028
無奈伤痛
無奈伤痛 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:05

    Something i found from google.

    A singly linked circular list is a linked list where the last node in thelist points to the first node in the list. A circular list does not contain NULL pointers.

    A good example of an application where circular linked list should be used is a timesharing problem solved by the operating system.

    In a timesharing environment, the operating system must maintain a list of present users and must alternately allow each user to use a small slice of CPU time, one user at a time. The operating system will pick a user, let him/her use a small amount of CPU time and then move on to the next user, etc.

    For this application, there should be no NULL pointers unless there is absolutely no one requesting CPU time.

提交回复
热议问题