DEV Community

Discussion on: Array Is Not A Linear Data Structure

Collapse
louy2 profile image
Yufan Lou Author

If you can access the elements in random order, why do you think they have exactly one predecessor and successor? Isn't any element the predecessor and successor of any other element?

Collapse
iquardt profile image
Iven Marquardt

..because arrays are indexed data structures and the index says so.

Thread Thread
louy2 profile image
Yufan Lou Author

We need some inevitable structure in the index to describe what we want. But as I demonstrated under "Definition 2", we are free to choose what that structure is. We've agreed on using integer exactly because it is much more powerful than linear, thus convenient for indexing random access.