- Simplest data structure that makes use of computed address to locate its elements is the one-dimensional array or vector;number of memory locations is sequentially allocated to the vector.
- A vector size is fixed and therefore requires a fixed number of memory locations.
- Vector A with subscript lower bound of “one” is represented as below
- L0is the address of the first word allocated to the first element of vector A.
- C words are allocated for each element or node
- The address of Ai is given equation Loc (Ai) = L0+ C (i-1)
- Let’s consider the more general case of representing a vector A whose lower bound for it’s subscript is given by some variable b. The location of Ai is then given by Loc (Ai) = L0+ C (i-b)
For any query or issue, feel free to discuss on http://discuss.eduguru.in
- Case Analysis in Data Structure
- Two Dimensional Array