Implementing pointers and objects in Design and analysis of algorithms free pdf
We can represent a collection of objects that have the same fields by using an array for each field. As an example, Figure shows how we can implement the linked list of Figure with three arrays. The array key holds the values of the keys currently in the dynamic set, and the pointers are stored in the arrays next and prev. For a given array index x, key[x], next[x], and prev[x] represent an object in the linked list. Under this interpretation, a pointer x is simply a common index into the key, next, and prev arrays.