Lists
The next group of data structures are lists. They were described in Chapter 4, Variants of Lists. Lists are similar to arrays but make it possible to dynamically increase the size of the collection, if necessary. It is worth mentioning that the built-in implementation is available for the array list (ArrayList
), as well as its generic (List
) and sorted (SortedList
) variants. The latter can be understood as a collection of key-value pairs, always sorted by keys.
There are a few other variants of lists, including a singly linked list, a doubly linked list, a circular singly linked list, and a circular doubly linked list. The first variant makes it possible to easily navigate from one element to the next one. However, it can be further expanded by allowing navigating in forward and backward directions, forming the doubly linked list. In the circular doubly linked list, the first node navigates to the last one in the case of backward direction, while the last node navigates to...