HOME

TheInfoList




Random access (more precisely and more generally called direct access) is the ability to access an arbitrary element of a sequence in equal time or any datum from a population of addressable elements roughly as easily and efficiently as any other, no matter how many elements may be in the set. In
computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of , , and . Computer science ...
it is typically contrasted to
sequential access Sequential access is a term describing a group of elements (such as data in a memory array or a Hard disk drive, disk file or on magnetic tape data storage) being accessed in a predetermined, ordered sequence. It is the opposite of random access, t ...
which requires data to be retrieved in the order it was stored. For example, data might be stored notionally in a single sequence like a row, in two dimensions like rows and columns on a surface, or in multiple dimensions. However, given all the coordinates, a program can access each record about as quickly and easily as any other. In this sense, the choice of datum is arbitrary in the sense that no matter which item is sought, all that is needed to find it is its address, i.e. the coordinates at which it is located, such as its row and column (or its track and record number on a
magnetic drum Magnetism is a class of physical phenomena that are mediated by magnetic fields. Electric currents and the magnetic moments of elementary particles give rise to a magnetic field, which acts on other currents and magnetic moments. Magnetism is one ...
). At first, the term "random access" was used because the process had to be capable of finding records no matter in which sequence they were required. However, soon the term "direct access" gained favour because one could directly retrieve a record, no matter what its position might be. The operative attribute, however, is that the device can access any required record immediately on demand. The opposite is
sequential access Sequential access is a term describing a group of elements (such as data in a memory array or a Hard disk drive, disk file or on magnetic tape data storage) being accessed in a predetermined, ordered sequence. It is the opposite of random access, t ...
, where a remote element takes longer time to access.
/ref> A typical illustration of this distinction is to compare an ancient scroll (parchment), scroll (sequential; all material prior to the data needed must be unrolled) and the
book A book is a medium for recording information Information is processed, organised and structured data Data (; ) are individual facts, statistics, or items of information, often numeric. In a more technical sense, data are a set of v ...

book
(direct: can be immediately flipped open to any arbitrary
page Page most commonly refers to: * Page (paper) A page is one side of a leaf A leaf (plural leaves) is the principal lateral appendage of the vascular plant plant stem, stem, usually borne above ground and specialized for photosynthesis. T ...
). A more modern example is a cassette tape (sequential — one must fast forward through earlier songs to get to later ones) and a (direct access — one can skip to the track wanted, knowing that it would be the one retrieved). In
data structure In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of ...

data structure
s, direct access implies the ability to access any entry in a
list A ''list'' is any set of items. List or lists may also refer to: People * List (surname)List or Liste is a European surname. Notable people with the surname include: List * Friedrich List (1789–1846), German economist * Garrett List (194 ...
in
constant time In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algor ...
(independent of its position in the list and of the list's size). Very few data structures can make this guarantee other than
array ARRAY, also known as ARRAY Now, is an independent distribution company launched by film maker and former publicist Ava DuVernay Ava Marie DuVernay (; born August 24, 1972) is an American filmmaker. She won the directing award in the U.S. dram ...
s (and related structures like
dynamic array In computer science, a dynamic array, growable array, resizable array, dynamic table, mutable array, or array list is a random access, variable-size list data structure that allows elements to be added or removed. It is supplied with standard libra ...

dynamic array
s). Direct access is required, or at least valuable, in many algorithms such as
binary search In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Al ...

binary search
,
integer sorting In computer science, integer sorting is the algorithmic problem of Sorting algorithm, sorting a collection of data values by integer keys. Algorithms designed for integer sorting may also often be applied to sorting problems in which the keys are fl ...
, or certain versions of
sieve of Eratosthenes In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). I ...

sieve of Eratosthenes
. Other data structures, such as
linked list In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of , ...

linked list
s, sacrifice direct access to permit efficient inserts, deletes, or re-ordering of data.
Self-balancing binary search tree 251px, The same tree after being height-balanced; the average path effort decreased to 3.00 node accesses In computer science, a self-balancing (or height-balanced) binary search tree is any node (computer science), node-based binary search tree ...
s may provide an acceptable compromise, where access time is not equal for all members of a collection, but the maximum time to retrieve a given member grows only
logarithmically In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). I ...
with its size.


References

{{reflist


See also

*
Data stream In connection-oriented communication Connection-oriented communication is a network communication mode in telecommunications and computer networking, where a communication session or a semi-permanent connection is established before any useful ...
*
Random-access machine In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algori ...
*
Random-access memory Random-access memory (RAM; ) is a form of computer memory In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic proces ...
although the
cache Cache, caching, or caché may refer to: Places * Cache (Aosta) Cache is a frazione of the city of Aosta, in the Aosta Valley region of Italy. Frazioni of Aosta Valley Aosta {{Aosta-geo-stub ..., a frazione in Italy * Cache Creek (disambig ...
and
virtual memory In computing, virtual memory, or virtual storage is a Memory management (operating systems), memory management technique that provides an "idealized abstraction of the storage resources that are actually available on a given machine" which "cre ...

virtual memory
make this no longer truly random access. *
Locality of reference In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algori ...
Computer memory