Search

Tuesday, February 18, 2014
6 comments

Circular Linked List for Data Structure in C Programming

9:02 AMTuesday, February 18, 2014
Circular Linked List

A little variation applied to linear linked list gives another type of linked list called as circular linked list. You might have observed in the linear linked list that the last node always points to the invalid address such as NULL address. Practically speaking the memory is wasted. Instead of NULL address if we think to keep the valid address in that field such as the address of the first node available in external pointer ROOT, then the linear linked list becomes circular linked list. As the last point in the circular linked list always points to the first node this type of linked list carries the name circular. The implementation is straightforward.
Whenever you create the circular linked list always assign the pointer field of the newly added node with the first node address given by ROOT(external pointer).

Algorithm to create a circular linked list:
         CREATECLL
         ROOT<--NULL;       CHOICE<--‘Y’
         Repeat While CHOICE=’Y’
            If AVAIL=NULL Then:
               Write: ’Memory Allocation Error’
               Exit.
            Else:
              NEW<--AVAIL
              NEW-->INFO<--Information
              AVAIL<--AVAIL-->LINK
           [End of if]
           If ROOT=NULL Then:
             ROOT<--NEW;   TEMP<--NEW
           Else:
             TEMP-->LINK<--NEW;    TEMP<--NEW
           [End of If]
           NEW-->LINK<--ROOT
           Write: ‘Do you want to add another node?(Y/N)’
           Read: CHOICE
          [End of while]
        Exit.
Protected by Copyscape Online Copyright Protection Software

6 comments :

  1. Fact!!! Thanks for sharing complete point…one more company has articles about Webdesign Agenter website pixo web design.

    ReplyDelete
  2. Your argument is excellent!! Unique points in the same, here one more website I like joomla development company.

    ReplyDelete
  3. I really appreciated with your content and completely agree with you, here also I was visit a company website Digital zona.

    ReplyDelete

 
Toggle Footer
Top