Computer Science, asked by chintu1059, 11 months ago

compare and contrast betwen singly linked list and circular linked list table

Answers

Answered by manikpad
0

SINGLE LINKED  CIRCULAR LIST

1)The structure of a node of singly linked  circular list is as follows:-

     Struct list_type

      {

          Int data;

        Struct list_type *next;

     }

 

 

2)Only one pointer is maintained in a node of singly list which contains the address of next node in sequence another will keep the address of.

3)In singly, we can not move in backward direction because each in node has next node pointer which facilitates us to move in forward direction.

4)During deletion of a node in between the singly list, we will have to keep two nodes address one the address of the node to be deleted and the node just previous of it.

DOUBLY LINKED CIRCULAR LIST

1)The structure of a node of doubly linked circular list is as follows:-

  {

        Int data;

       Struct doubly_list *previous;

       Struct doubly_list *next;

  }

2)Two pointers are maintained in a node of doubly list, one will keep the address of first previous node and first next node in sequence.

3)In doubly list, we can move backward as well as forward direction as each node keeps the address of previous and next node in sequence.

4)During deletion, we have to keep only one node address i.e the node to be deleted. This node will give the address of previous node automatically.

SIMILARITIES….

This similarity between singly linked circular list & doubly linked circular list is that the next pointer of last node of both list will point to the first node.

The advantage of singly linked circular list is that we can go the first node automatically when we are on last node we don’t have to again set the pointer to first node.

The second advantage is that the next pointer of last node is utilized because it keeps the address of first node.

The advantage of doubly circular list is that we can move in backward as will as forward direction. Besides if we have reached at last node and have to go to first node then instead of using the previous pointers to reach to first node we will use the next pointer of last node because in doubly circular list the next pointer of last contains the address OF the node.


Similar questions