The document defines circular linked lists, highlighting their differences from linear linked lists, particularly the absence of null values in connection fields. It details operations like creation, insertion, deletion, and traversal, with examples for front and back insertion and deletion. The document emphasizes caution against overlooping due to the circular nature and provides contact information for the author.
Linked list thathasn’t null (nil) value in its
connection field.
Circular Linked List
2 4 5 9
Awal Akhir
2 4 5 9
Awal Akhir
Circular Single Linked list
Circular Double Linked list
• If listis empty (awal = nil).
Front Insertion
awal akhir
baru 1
akhir baru
awal baru
baru↑.info 1
baru↑.next baru
alloc(baru)
7.
• If listisn’t empty (awal ≠ nil). For example,
there is list that has two nodes:
Front Insertion (cont’d)
baru 1
alloc(baru)
baru↑.info 1
akhirawal
2 3
The last resultfor back insertion if linked list
wasn’t empty:
Back Insertion (cont’d)
akhirawal
3 2
baru
1
18.
Circular linked listdoesn’t give effect for
middle insertion. The algorithm is same as
middle insertion in linear single or double
linked list (depend on implementation of
circular linked list).
Middle Insertion
• Delete onenode in beggining of linked list if
linked list has only one node (awal = akhir).
Front Deletion
awal akhir
1 THEN
elemen
phapus
phapus awal elemen phapus↑.info
awal nil
awal
akhir
akhir nil
dealloc(phapus)
21.
• If linkedlist has more than one node (awal ≠
akhir). For example, linked list has two
nodes.
Front Deletion (cont’d)
akhirawal
2 3
The last resultfor front deletion if linked list has
more than one node:
Front Deletion (cont’d)
akhirawal
2 3phapus
elemen
24.
• Delete onenode in back of linked list if
linked list has only one node (awal = akhir).
This process is same as front
deletion if linked list has
only one node.
Back Deletion
25.
• If linkedlist has more than one node (awal ≠
akhir). For example, linked list has four
nodes.
Back Deletion (cont’d)
akhir
3
awal
1 42
26.
Back Deletion (cont’d)
akhir
phapus awal
phapus
elemen
elemen akhir↑.info akhir phapus
akhir↑.next awal
dealloc(phapus)
3
awal
1 42
phapus
phapus phapus↑.nextwhile (phapus↑.next ≠ akhir)
do
phapus phapus↑.next
endwhile
27.
The last resultfor back deletion if linked list has
more than one node:
Back Deletion (cont’d)
akhirphapus
elemen
3
awal
1 42
phapus
28.
Other operations ofcircular linked list are same
as linear single or double linked list but be
careful of overlooping (endless looping)because
there aren’t null value in its connection fields.
Other Operation