LinkedLists

A linked list is a list of elements not contiguous in memory but ordered by each element having a link to the next element. It is a collection of nodes.

jb stevenard

--

Simple LinkedList

This simple linked list represents a sequence of 3 elements (2, 4, 6).

We can create this list like above, but let’s dig into how we can create a Linked list and node class.

This is a node representing an element of type T (here, we made it generic but could use any type, Int, String, …) and a link “next” to the next node (or not in case end of the list).

--

--

jb stevenard

iOS Software Engineer @Meta, ex: TikTok, Agoda. Nature Lover, Tech & Personal Finance, Food & Training Addict. https://medium.com/@jbstevenard/membership