Array-based list

The array-based list, also known as array list, is a resizable array implementation. Thus, as more elements are added to the linked list, its size increases dynamically. The array-based list assigns an element to the assigned array; however, if a new element is assigned some data, and there is no space in the array, then it allocates a new array, and moves all the data to the newly allocated array. For example, as shown in Figure 3.19, since the array is full, all of the data is reassigned to a bigger array by increasing the size by a default value.

Array-based list

Figure 3.19: Example array-based link list

Let us set up a reference class ALinkList ...

Get R Data Structures and Algorithms now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.