Jump to content

Random access

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by WillNess (talk | contribs) at 10:00, 21 September 2011 (wikify). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Random access compared to sequential access.

In computer science, random access (sometimes called direct access) is the ability to access an arbitrary element of a sequence in equal time. The element 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.[1] 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 phonograph record (random access—you can place the needle right on the groove you want).

In data structures, random access implies the ability to access the Nth entry in a list of numbers in constant time. Very few data structures can guarantee this, other than arrays (and related structures like dynamic arrays). Random access is critical to many algorithms such as quicksort and binary search. Other data structures, such as linked lists, sacrifice random access to make for efficient inserts, deletes, or reordering of data.

See also

References