In computer science, random access (sometimes called direct access) is the ability to access an element at an arbitrary position in a sequence in equal time, independent of sequence size. The position is arbitrary in the sense that it is unpredictable, thus the use of the term "random" in "random access". The opposite is sequential access, where a remote element takes longer time to access. A typical illustration of this distinction is to compare an ancient scroll (sequential; all material prior to the data needed must be unrolled) and the book (random: can be immediately flipped open to any random page). A more modern example is a cassette tape (sequential—you have to fast-forward through earlier songs to get to later ones) and a CD (random access—you can skip to the track you want).
In data structures, random access implies the ability to access any entry in a list in constant (i.e. independent of its position in the list and of list's size, i.e. ) time. Very few data structures can guarantee this, other than arrays (and related structures like dynamic arrays). Random access is critical, or at least valuable, to many algorithms such as binary search, integer sorting or certain versions of sieve of Eratosthenes. Other data structures, such as linked lists, sacrifice random access to make for efficient inserts, deletes, or reordering of data. Self-balancing binary search trees may provide an acceptable compromise, where access time is equal for any member of a collection and only grows logarithmically with its size.
Famous quotes containing the words random and/or access:
“We should stop looking to law to provide the final answer.... Law cannot save us from ourselves.... We have to go out and try to accomplish our goals and resolve disagreements by doing what we think is right. That energy and resourcefulness, not millions of legal cubicles, is what was great about America. Let judgment and personal conviction be important again.”
—Philip K. Howard, U.S. lawyer. The Death of Common Sense: How Law Is Suffocating America, pp. 186-87, Random House (1994)
“The last publicized center of American writing was Manhattan. Its writers became known as the New York Intellectuals. With important connections to publishing, and universities, with access to the major book reviews, they were able to pose as the vanguard of American culture when they were so obsessed with the two JoesMcCarthy and Stalinthat they were to produce only two artists, Saul Bellow and Philip Roth, who left town.”
—Ishmael Reed (b. 1938)