Pertemuan ke 2, Linked List Implementation I, 2101678775, Rafael Kevin Liman.
Linked
List Implementation I
Sub
Topics
Linked
List:
-
Single
Linked List
-
Polynomial
Representation
-
Circular
Single Linked List
-
Doubly
Linked List
Single
Linked List: Insert
To insert a
new value, first we should dynamically allocate a new node and assign the value
to it and then connect it with the existing linked list.
Single
Linked List: Delete
To delete a
value, first we should find the location of node which store
the value we want to delete, remove it, and connect the
remaining linked list.
Polynomial
Representation
•
Polynomial
is given as 6x3 + 9x2 + 1
•
Every
individual term in a polynomial consists of two parts, a coefficient and a
power
•
Here,
6, 9, 7, and 1 are the coefficients of the terms that have 3, 2, 1, and 0 as
their power respectively.
•
Every
term of a polynomial can be represented as a node of the linked list.
Circular
Single Linked List
•
In
circular, last node contains a pointer to the first node
•
We
can have a circular singly linked list as well as a circular doubly linked
list.
•
There
is no storing of NULL values in the list
Doubly
Linked List
Doubly
linked list or
two-way linked list is a linked list data
structure
with two link, one that contain reference to the next data
and one
that contain reference to the previous data.
Header
Linked List
•
A
header linked list is a special type of linked list which contains a header
node at the beginning of the list.
•
In
a header linked list, START (L) will not point to the first node of the list
but START (L) will contain the address of the header node.