SlideShare a Scribd company logo
Header, Circular and Two-way
Linked Lists
Header Linked Lists
• Header linked list is a linked list which always contains a special
node called the Header Node, at the beginning of the list.
• It has two types:
a) Grounded Header List
Last Node Contains the NULL Pointer.
b) Circular Header List
Last Node Points Back to the Header Node.
2
Header linked list
Grounded Header linked list Circular Header linked list
Grounded Header Linked List
• A grounded header list is a header list where the last
node contains the null pointer.
• The term “grounded” comes from the fact that many
texts use the electrical ground symbol to indicate the
null pointer.
Header Node
Start
Figure: Grounded Header Link List
Circular Header Linked List
• A circular header linked list is a header list where the last
node points back to the header node.
• START always points to the header node.
• LINK[START] = NULL means grounded header list is empty.
• LINK[START] = START indicates that a circular header list is
empty.
Header Node
Figure: Circular Header Link List
Start
Benefits of using Circular Header List
• The null pointer is not used, and hence pointers contain valid
addresses.
• Every (ordinary) node has a predecessor, so the first node
may not require a special case.
Traversing a Circular Header List
Let LIST be a circular header list in memory. This algorithm traverses list,
applying an operation PROCESS to each element of LIST. The variable
PTR points to the node currently being processed.
1. Set PTR := LINK[START]. [Initializes pointer PTR.]
2. Repeat Steps 3 and 4 while PTR != START.
3. Apply PROCESS to INFO[PTR].
4. Set PTR := LINK[PTR]. [PTR now points to the next node.]
[End of Step 2 loop.]
5. Exit.
Searching in circular header list
SRCHHL(INFO,LINK,START,ITEM,LOC)
1 Set PTR=LINK[START]
2 Repeat while INFO[PTR]!=ITEM and PTR!=START
Set PTR=LINK[PTR]
3 if INFO[PTR]=ITEM, then
Set LOC=PTR
Else Set LOC=NULL
4 EXIT
Two-way lists
• A two-way list is a linear collection of data elements,
called nodes, where each node N is divided into three
parts:
– Information field
– Forward Link which points to the next node
– Backward Link which points to the previous node
• The starting address or the address of first node is stored
in START / FIRST pointer .
• Another pointer can be used to traverse list from end.
This pointer is called END or LAST.
Two-way lists(cont…)
• Every node (except the last node) contains the
address of the next node, and every node (except
the first node) contains the address of the previous
node.
• A two-way list (doubly linked list) can be traversed in
either direction.
Representation of
Two-way lists
Start
X 4 2 10
Last
INFO Field
BACK Pointer
FORE Pointer
X
Inserting
• INST(INFO, FORW, BACK, START, LOCA, LOCB,
ITEM)
1. Set NEW := AVAIL, AVAIL=FORW[AVAIL].
[Allocate memory to the new node.]
2. 3. INFO[NEW] := ITEM.
4. Set FORW[LOCA] := NEW, FORW[NEW] := LOCB,
BACK[LOCB] := NEW, BACK[NEW] := LOCA.
5. Exit.
Deletion
DEL(INFO, FORW, BACK, START, LOC)
1. Set FORW[BACK[LOC]] := FORW[LOC], and
BACK[FORW[LOC]] := BACK[LOC].
2. Free memory.
FREE[LOC].
3. Exit.

More Related Content

What's hot

Data Structures (CS8391)
Data Structures (CS8391)Data Structures (CS8391)
Data Structures (CS8391)
Elavarasi K
 
Array ppt
Array pptArray ppt
Array ppt
Kaushal Mehta
 
Insertion in singly linked list
Insertion in singly linked listInsertion in singly linked list
Insertion in singly linked list
Keval Bhogayata
 
Arrays
ArraysArrays
Array in c language
Array in c languageArray in c language
Array in c languagehome
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
Poojith Chowdhary
 
Data structures using c
Data structures using cData structures using c
Data structures using c
Prof. Dr. K. Adisesha
 
Circular link list.ppt
Circular link list.pptCircular link list.ppt
Circular link list.ppt
Tirthika Bandi
 
12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMSkoolkampus
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
Nilesh Dalvi
 
Linked List - Insertion & Deletion
Linked List - Insertion & DeletionLinked List - Insertion & Deletion
Linked List - Insertion & Deletion
Afaq Mansoor Khan
 
Data structure ppt
Data structure pptData structure ppt
Data structure ppt
Prof. Dr. K. Adisesha
 
Dbms architecture
Dbms architectureDbms architecture
Dbms architecture
Shubham Dwivedi
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
Muhammad Hammad Waseem
 
Binary Search Tree in Data Structure
Binary Search Tree in Data StructureBinary Search Tree in Data Structure
Binary Search Tree in Data Structure
Dharita Chokshi
 
Two dimensional arrays
Two dimensional arraysTwo dimensional arrays
Two dimensional arrays
Neeru Mittal
 
Pointer in c
Pointer in cPointer in c
Pointer in c
lavanya marichamy
 
Linear search-and-binary-search
Linear search-and-binary-searchLinear search-and-binary-search
Linear search-and-binary-search
International Islamic University
 
Pointers C programming
Pointers  C programmingPointers  C programming
Pointers C programming
Appili Vamsi Krishna
 

What's hot (20)

Data Structures (CS8391)
Data Structures (CS8391)Data Structures (CS8391)
Data Structures (CS8391)
 
Array ppt
Array pptArray ppt
Array ppt
 
Insertion in singly linked list
Insertion in singly linked listInsertion in singly linked list
Insertion in singly linked list
 
single linked list
single linked listsingle linked list
single linked list
 
Arrays
ArraysArrays
Arrays
 
Array in c language
Array in c languageArray in c language
Array in c language
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Data structures using c
Data structures using cData structures using c
Data structures using c
 
Circular link list.ppt
Circular link list.pptCircular link list.ppt
Circular link list.ppt
 
12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
 
Linked List - Insertion & Deletion
Linked List - Insertion & DeletionLinked List - Insertion & Deletion
Linked List - Insertion & Deletion
 
Data structure ppt
Data structure pptData structure ppt
Data structure ppt
 
Dbms architecture
Dbms architectureDbms architecture
Dbms architecture
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 
Binary Search Tree in Data Structure
Binary Search Tree in Data StructureBinary Search Tree in Data Structure
Binary Search Tree in Data Structure
 
Two dimensional arrays
Two dimensional arraysTwo dimensional arrays
Two dimensional arrays
 
Pointer in c
Pointer in cPointer in c
Pointer in c
 
Linear search-and-binary-search
Linear search-and-binary-searchLinear search-and-binary-search
Linear search-and-binary-search
 
Pointers C programming
Pointers  C programmingPointers  C programming
Pointers C programming
 

Similar to header, circular and two way linked lists

4.linked list(contd.)
4.linked list(contd.)4.linked list(contd.)
4.linked list(contd.)
Chandan Singh
 
Lecture 5 data structures and algorithms
Lecture 5 data structures and algorithmsLecture 5 data structures and algorithms
Lecture 5 data structures and algorithmsAakash deep Singhal
 
Dounly linked list
Dounly linked listDounly linked list
Dounly linked list
NirmalPandey23
 
Bca data structures linked list mrs.sowmya jyothi
Bca data structures linked list mrs.sowmya jyothiBca data structures linked list mrs.sowmya jyothi
Bca data structures linked list mrs.sowmya jyothi
Sowmya Jyothi
 
Linked List
Linked ListLinked List
Linked List
RaaviKapoor
 
5.Linked list
5.Linked list 5.Linked list
5.Linked list
Mandeep Singh
 
DSModule2.pptx
DSModule2.pptxDSModule2.pptx
DSModule2.pptx
ChrisSosaJacob
 
unit 2- PPT.pdf
unit 2- PPT.pdfunit 2- PPT.pdf
unit 2- PPT.pdf
PranavMakwana6
 
Data structure and algorithms chapter three LINKED LIST
Data structure and algorithms chapter three LINKED LISTData structure and algorithms chapter three LINKED LIST
Data structure and algorithms chapter three LINKED LIST
binakasehun2026
 
cp264_lecture13_14_linkedlist.ppt
cp264_lecture13_14_linkedlist.pptcp264_lecture13_14_linkedlist.ppt
cp264_lecture13_14_linkedlist.ppt
ssuser9dd05f
 
Linked list using Dynamic Memory Allocation
Linked list using Dynamic Memory AllocationLinked list using Dynamic Memory Allocation
Linked list using Dynamic Memory Allocation
kiran Patel
 
Operations on linked list
Operations on linked listOperations on linked list
Operations on linked list
Sumathi Kv
 
ds 4Linked lists.ppt
ds 4Linked lists.pptds 4Linked lists.ppt
ds 4Linked lists.ppt
AlliVinay1
 
Linked List Presentation in data structurepptx
Linked List Presentation in data structurepptxLinked List Presentation in data structurepptx
Linked List Presentation in data structurepptx
nikhilcse1
 
Data structure lecture 5
Data structure lecture 5Data structure lecture 5
Data structure lecture 5Kumar
 
linked_list.pptx
linked_list.pptxlinked_list.pptx
linked_list.pptx
Koteswari Kasireddy
 
Linear data structure concepts
Linear data structure conceptsLinear data structure concepts
Linear data structure concepts
Akila Krishnamoorthy
 

Similar to header, circular and two way linked lists (20)

4.linked list(contd.)
4.linked list(contd.)4.linked list(contd.)
4.linked list(contd.)
 
Lecture 5 data structures and algorithms
Lecture 5 data structures and algorithmsLecture 5 data structures and algorithms
Lecture 5 data structures and algorithms
 
Dounly linked list
Dounly linked listDounly linked list
Dounly linked list
 
Bca data structures linked list mrs.sowmya jyothi
Bca data structures linked list mrs.sowmya jyothiBca data structures linked list mrs.sowmya jyothi
Bca data structures linked list mrs.sowmya jyothi
 
Linked List
Linked ListLinked List
Linked List
 
5.Linked list
5.Linked list 5.Linked list
5.Linked list
 
DSModule2.pptx
DSModule2.pptxDSModule2.pptx
DSModule2.pptx
 
unit 2- PPT.pdf
unit 2- PPT.pdfunit 2- PPT.pdf
unit 2- PPT.pdf
 
Data structure and algorithms chapter three LINKED LIST
Data structure and algorithms chapter three LINKED LISTData structure and algorithms chapter three LINKED LIST
Data structure and algorithms chapter three LINKED LIST
 
cp264_lecture13_14_linkedlist.ppt
cp264_lecture13_14_linkedlist.pptcp264_lecture13_14_linkedlist.ppt
cp264_lecture13_14_linkedlist.ppt
 
Linked list using Dynamic Memory Allocation
Linked list using Dynamic Memory AllocationLinked list using Dynamic Memory Allocation
Linked list using Dynamic Memory Allocation
 
Operations on linked list
Operations on linked listOperations on linked list
Operations on linked list
 
ds 4Linked lists.ppt
ds 4Linked lists.pptds 4Linked lists.ppt
ds 4Linked lists.ppt
 
Team 10
Team 10Team 10
Team 10
 
Linked List Presentation in data structurepptx
Linked List Presentation in data structurepptxLinked List Presentation in data structurepptx
Linked List Presentation in data structurepptx
 
Data structures2
Data structures2Data structures2
Data structures2
 
Data structure lecture 5
Data structure lecture 5Data structure lecture 5
Data structure lecture 5
 
linked_list.pptx
linked_list.pptxlinked_list.pptx
linked_list.pptx
 
Lect 11-12 Zaheer Abbas
Lect 11-12 Zaheer AbbasLect 11-12 Zaheer Abbas
Lect 11-12 Zaheer Abbas
 
Linear data structure concepts
Linear data structure conceptsLinear data structure concepts
Linear data structure concepts
 

More from student

Logic Gates
Logic GatesLogic Gates
Logic Gatesstudent
 
Flipflops and Excitation tables of flipflops
Flipflops and Excitation tables of flipflopsFlipflops and Excitation tables of flipflops
Flipflops and Excitation tables of flipflops
student
 
Number Systems
Number SystemsNumber Systems
Number Systems
student
 
towers of hanoi
towers of hanoitowers of hanoi
towers of hanoistudent
 
Arrays Data Structure
Arrays Data StructureArrays Data Structure
Arrays Data Structure
student
 
Number Systems
Number SystemsNumber Systems
Number Systems
student
 
binary arithmetic rules
binary arithmetic rulesbinary arithmetic rules
binary arithmetic rules
student
 
BCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codesBCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codes
student
 
animals colours numbers idioms
animals colours numbers idiomsanimals colours numbers idioms
animals colours numbers idiomsstudent
 
irregular verbs
irregular verbsirregular verbs
irregular verbsstudent
 
dc generator ece
dc generator ecedc generator ece
dc generator ecestudent
 
INDUCTION MOTOR
INDUCTION MOTORINDUCTION MOTOR
INDUCTION MOTORstudent
 
structure and union
structure and unionstructure and union
structure and unionstudent
 
storage class
storage classstorage class
storage classstudent
 
file handling1
file handling1file handling1
file handling1student
 
direct and indirect band gap
direct and indirect band gapdirect and indirect band gap
direct and indirect band gapstudent
 
hall effect
hall effecthall effect
hall effectstudent
 
optics chapter_07_solution_manual
optics chapter_07_solution_manualoptics chapter_07_solution_manual
optics chapter_07_solution_manualstudent
 
dyneins and kinesins
dyneins and kinesinsdyneins and kinesins
dyneins and kinesinsstudent
 
Structure and function of bacterial cells
Structure and function of bacterial cellsStructure and function of bacterial cells
Structure and function of bacterial cellsstudent
 

More from student (20)

Logic Gates
Logic GatesLogic Gates
Logic Gates
 
Flipflops and Excitation tables of flipflops
Flipflops and Excitation tables of flipflopsFlipflops and Excitation tables of flipflops
Flipflops and Excitation tables of flipflops
 
Number Systems
Number SystemsNumber Systems
Number Systems
 
towers of hanoi
towers of hanoitowers of hanoi
towers of hanoi
 
Arrays Data Structure
Arrays Data StructureArrays Data Structure
Arrays Data Structure
 
Number Systems
Number SystemsNumber Systems
Number Systems
 
binary arithmetic rules
binary arithmetic rulesbinary arithmetic rules
binary arithmetic rules
 
BCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codesBCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codes
 
animals colours numbers idioms
animals colours numbers idiomsanimals colours numbers idioms
animals colours numbers idioms
 
irregular verbs
irregular verbsirregular verbs
irregular verbs
 
dc generator ece
dc generator ecedc generator ece
dc generator ece
 
INDUCTION MOTOR
INDUCTION MOTORINDUCTION MOTOR
INDUCTION MOTOR
 
structure and union
structure and unionstructure and union
structure and union
 
storage class
storage classstorage class
storage class
 
file handling1
file handling1file handling1
file handling1
 
direct and indirect band gap
direct and indirect band gapdirect and indirect band gap
direct and indirect band gap
 
hall effect
hall effecthall effect
hall effect
 
optics chapter_07_solution_manual
optics chapter_07_solution_manualoptics chapter_07_solution_manual
optics chapter_07_solution_manual
 
dyneins and kinesins
dyneins and kinesinsdyneins and kinesins
dyneins and kinesins
 
Structure and function of bacterial cells
Structure and function of bacterial cellsStructure and function of bacterial cells
Structure and function of bacterial cells
 

Recently uploaded

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 

Recently uploaded (20)

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 

header, circular and two way linked lists

  • 1. Header, Circular and Two-way Linked Lists
  • 2. Header Linked Lists • Header linked list is a linked list which always contains a special node called the Header Node, at the beginning of the list. • It has two types: a) Grounded Header List Last Node Contains the NULL Pointer. b) Circular Header List Last Node Points Back to the Header Node. 2 Header linked list Grounded Header linked list Circular Header linked list
  • 3. Grounded Header Linked List • A grounded header list is a header list where the last node contains the null pointer. • The term “grounded” comes from the fact that many texts use the electrical ground symbol to indicate the null pointer. Header Node Start Figure: Grounded Header Link List
  • 4. Circular Header Linked List • A circular header linked list is a header list where the last node points back to the header node. • START always points to the header node. • LINK[START] = NULL means grounded header list is empty. • LINK[START] = START indicates that a circular header list is empty. Header Node Figure: Circular Header Link List Start
  • 5. Benefits of using Circular Header List • The null pointer is not used, and hence pointers contain valid addresses. • Every (ordinary) node has a predecessor, so the first node may not require a special case.
  • 6. Traversing a Circular Header List Let LIST be a circular header list in memory. This algorithm traverses list, applying an operation PROCESS to each element of LIST. The variable PTR points to the node currently being processed. 1. Set PTR := LINK[START]. [Initializes pointer PTR.] 2. Repeat Steps 3 and 4 while PTR != START. 3. Apply PROCESS to INFO[PTR]. 4. Set PTR := LINK[PTR]. [PTR now points to the next node.] [End of Step 2 loop.] 5. Exit.
  • 7. Searching in circular header list SRCHHL(INFO,LINK,START,ITEM,LOC) 1 Set PTR=LINK[START] 2 Repeat while INFO[PTR]!=ITEM and PTR!=START Set PTR=LINK[PTR] 3 if INFO[PTR]=ITEM, then Set LOC=PTR Else Set LOC=NULL 4 EXIT
  • 8. Two-way lists • A two-way list is a linear collection of data elements, called nodes, where each node N is divided into three parts: – Information field – Forward Link which points to the next node – Backward Link which points to the previous node • The starting address or the address of first node is stored in START / FIRST pointer . • Another pointer can be used to traverse list from end. This pointer is called END or LAST.
  • 9. Two-way lists(cont…) • Every node (except the last node) contains the address of the next node, and every node (except the first node) contains the address of the previous node. • A two-way list (doubly linked list) can be traversed in either direction.
  • 10. Representation of Two-way lists Start X 4 2 10 Last INFO Field BACK Pointer FORE Pointer X
  • 11. Inserting • INST(INFO, FORW, BACK, START, LOCA, LOCB, ITEM) 1. Set NEW := AVAIL, AVAIL=FORW[AVAIL]. [Allocate memory to the new node.] 2. 3. INFO[NEW] := ITEM. 4. Set FORW[LOCA] := NEW, FORW[NEW] := LOCB, BACK[LOCB] := NEW, BACK[NEW] := LOCA. 5. Exit.
  • 12. Deletion DEL(INFO, FORW, BACK, START, LOC) 1. Set FORW[BACK[LOC]] := FORW[LOC], and BACK[FORW[LOC]] := BACK[LOC]. 2. Free memory. FREE[LOC]. 3. Exit.