Linked List in Swift

Swift provides three primary collection types, known as arrays, sets, and dictionaries.
- An Array is an ordered collection of values.
- A Set is an unordered collections of unique values.
- Dictionaries are unordered collections of key-value associations. read more

A linked list is a data structure in which each node contains the pointer of the next element in the list. So all the elements of a linked list are connected to each other. Hence the name linked list forming a sort of a chain.
If we consider an individual Array element of Integer type. Each element of the array contains two values ie. the value itself and its index. Whereas a Linked list element contains a value and the reference to the next element of the list for a singly linked list.

For a doubly linked list, an element in the list contains a reference to the previous element in addition to the next element.
Why use Linked List?
- Adding or removing elements is a lot faster in a linked list than in an array.
- Iterating sequentially over the list one by one is more or less the same speed in a linked list and an array.
- Getting one specific element in the middle is a lot faster in an array.
Now we shall tackle the CRUD Operations.
Append Node to linked list
Read node at Index
Update node at Position in Linked List
Delete Node with Value
References:
