Wednesday, April 26, 2017
Abstract arrays
An array data structure can be mathematically modeled as an abstract data structure (an abstract array) with two operations
- get(A, I): the data stored in the element of the array A whose indices are the integer tuple I.
- set(A,I,V): the array that results by setting the value of that element to V.
These operations are required to satisfy the axioms
- get(set(A,I, V), I) = V
- get(set(A,I, V), J) = get(A, J) if I ≠ J
for any array state A, any value V, and any tuples I, J for which the operations are defined.
The first axiom means that each element behaves like a variable. The second axiom means that elements with distinct indices behave as disjoint variables, so that storing a value in one element does not affect the value of any other element.
These axioms do not place any constraints on the set of valid index tuples I, therefore this abstract model can be used for triangular matrices and other oddly-shaped arrays.
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment