Singly-Linked Lists
are a data structure that allows allocation of memory and storage space in a non-linear manner. They are different from doubly-linked lists in that you cannot traverse them in reverse.
A singly-linked list is a version of a list. It hold data by linking Nodes
togehter through the use of pointers.
Singly-Linked Lists
By linking the pointers for next Node
points for each Node
, we can traverse the Singly-Linked List
for various values and store allocation non-linear memory and storage space for data.
Singly-Linked Lists
have the following runtime complexities:
O(n)
for lookup timesO(n)
for searching (e.g. "traversing") itO(1)
time for insertionO(1)
time for deletion
It also has a space complexity of O(n)
, despite the non-linearity of its nature. This space complexity is directly related to the size of values stored in the list.