SlideShare a Scribd company logo
1 of 17
Circular Linked List EENG212  Algorithms and  Data Structures
Circular Linked Lists ,[object Object],[object Object]
Circular Linked Lists A Linear Linked List
Circular Linked Lists
Circular Linked Lists
Circular Linked Lists ,[object Object],[object Object],[object Object],[object Object]
PRIMITIVE FUNCTIONS IN CIRCULAR LISTS ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
PRIMITIVE FUNCTIONS IN CIRCULAR LISTS ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
PRIMITIVE FUNCTIONS IN CIRCULAR LISTS ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
CIRCULAR LIST with header node ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
CIRCULAR LIST with header node
CIRCULAR LIST with header node ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
CIRCULAR LIST with header node
Example ,[object Object],[object Object],[object Object]
a) struct node{ char Name[15];   int AccNo; float Balance; struct node *next; }; typedef struct node  *NODEPTR ; b)  Assume that the list pointer points the header with the sentinel   account number -99 . void DispNegBalanca( NODEPTR  *plist) { NODEPTR  p; p= * plist; if(p == NULL){ printf(“There is no list!”); exit(1); } p=p->next; while(p->AccNo!=-99){ if(p->Balance < 0.0) printf(“The Customer Name:%sThe Account No:%dThe Balance:%.2f”, p->Name, p->AccNo, p->Balance); p=p->next; } }
Example ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
float avList( NODEPTR  *plist) /*assume that plist points the header node*/ { int count=0; float sum =0.0; NODEPTR  p; p= * plist; if((p == NULL)){ printf(“Empty list”); exit(1); } do{ sum=sum + p->info; p =p->next; count++; }while(p->flag !=1); return sum/count; }

More Related Content

What's hot

Queue Implementation Using Array & Linked List
Queue Implementation Using Array & Linked ListQueue Implementation Using Array & Linked List
Queue Implementation Using Array & Linked List
PTCL
 

What's hot (20)

B and B+ tree
B and B+ treeB and B+ tree
B and B+ tree
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
 
Stack
StackStack
Stack
 
queue & its applications
queue & its applicationsqueue & its applications
queue & its applications
 
Stacks
StacksStacks
Stacks
 
Queue Implementation Using Array & Linked List
Queue Implementation Using Array & Linked ListQueue Implementation Using Array & Linked List
Queue Implementation Using Array & Linked List
 
Data Structures (CS8391)
Data Structures (CS8391)Data Structures (CS8391)
Data Structures (CS8391)
 
Double ended queue
Double ended queueDouble ended queue
Double ended queue
 
Linked list
Linked listLinked list
Linked list
 
Queues
QueuesQueues
Queues
 
trees in data structure
trees in data structure trees in data structure
trees in data structure
 
Linked list
Linked list Linked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 
Data Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListData Structure and Algorithms Linked List
Data Structure and Algorithms Linked List
 
Chapter 12 ds
Chapter 12 dsChapter 12 ds
Chapter 12 ds
 
Queue data structure
Queue data structureQueue data structure
Queue data structure
 
sorting and searching.pptx
sorting and searching.pptxsorting and searching.pptx
sorting and searching.pptx
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 

Similar to Circular linked list

Similar to Circular linked list (20)

Circular_Linked_List.ppt
Circular_Linked_List.pptCircular_Linked_List.ppt
Circular_Linked_List.ppt
 
Linked list1.ppt
Linked list1.pptLinked list1.ppt
Linked list1.ppt
 
Link List
Link ListLink List
Link List
 
Linked List.pptx
Linked List.pptxLinked List.pptx
Linked List.pptx
 
linkedlist (1).ppt
linkedlist (1).pptlinkedlist (1).ppt
linkedlist (1).ppt
 
Data structure
Data structureData structure
Data structure
 
17 linkedlist (1)
17 linkedlist (1)17 linkedlist (1)
17 linkedlist (1)
 
Linkedlist
LinkedlistLinkedlist
Linkedlist
 
Wk11-linkedlist.ppt
Wk11-linkedlist.pptWk11-linkedlist.ppt
Wk11-linkedlist.ppt
 
Wk11-linkedlist.ppt
Wk11-linkedlist.pptWk11-linkedlist.ppt
Wk11-linkedlist.ppt
 
Algo>ADT list & linked list
Algo>ADT list & linked listAlgo>ADT list & linked list
Algo>ADT list & linked list
 
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
 
LINKED LIST.pptx
LINKED LIST.pptxLINKED LIST.pptx
LINKED LIST.pptx
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
linkedlist.ppt
linkedlist.pptlinkedlist.ppt
linkedlist.ppt
 
Chapter 5 ds
Chapter 5 dsChapter 5 ds
Chapter 5 ds
 
Linked List.ppt
Linked List.pptLinked List.ppt
Linked List.ppt
 
Wk11-linkedlist.ppt
Wk11-linkedlist.pptWk11-linkedlist.ppt
Wk11-linkedlist.ppt
 
Wk11-linkedlist.ppt
Wk11-linkedlist.pptWk11-linkedlist.ppt
Wk11-linkedlist.ppt
 
Wk11-linkedlist.ppt
Wk11-linkedlist.pptWk11-linkedlist.ppt
Wk11-linkedlist.ppt
 

Recently uploaded

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
ssuserdda66b
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 

Circular linked list

  • 1. Circular Linked List EENG212 Algorithms and Data Structures
  • 2.
  • 3. Circular Linked Lists A Linear Linked List
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. CIRCULAR LIST with header node
  • 12.
  • 13. CIRCULAR LIST with header node
  • 14.
  • 15. a) struct node{ char Name[15]; int AccNo; float Balance; struct node *next; }; typedef struct node *NODEPTR ; b) Assume that the list pointer points the header with the sentinel account number -99 . void DispNegBalanca( NODEPTR *plist) { NODEPTR p; p= * plist; if(p == NULL){ printf(“There is no list!”); exit(1); } p=p->next; while(p->AccNo!=-99){ if(p->Balance < 0.0) printf(“The Customer Name:%sThe Account No:%dThe Balance:%.2f”, p->Name, p->AccNo, p->Balance); p=p->next; } }
  • 16.
  • 17. float avList( NODEPTR *plist) /*assume that plist points the header node*/ { int count=0; float sum =0.0; NODEPTR p; p= * plist; if((p == NULL)){ printf(“Empty list”); exit(1); } do{ sum=sum + p->info; p =p->next; count++; }while(p->flag !=1); return sum/count; }