The linked list is not good with access time O (n), The insertion time is excellent at O (1).
The linked list node contains the data and next pointing to the next link. null is stored in next.
Node1.data = "G"
Node1.next = Node2
Node2.data = "R"
Node2.next = Node3
Node3.data = "O"
Node3.next = Node4
Node4.data = "W"
Node4.next = null
#Node1.next.next means Node3.
There is also a bi-directional linked list called bi-directional.
Node2.data = "5"
Node1.next = Node2
Node2.previous = Node1
#Both 1 to 2 and 2 to 1 are defined.
Recommended Posts