ch6 - Ch. 6 Tables: 6.1 Introduction: lists sequence...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
2001-2009 M. D. Evans All Rights Reserved 1 Ch. 6 Tables: 6.1 Introduction: lists vs tables sequence function position oriented wrt value (key-value) data items + opns oriented operations (next to) (look up) Def: A table with index set I and base type T is a function from I into T together with the opns: access – eval fn at any index I, rtn item insertion – of new element X to the index set. Define a corresponding value of the fn at X. deletion – delete X from I, and restrict fn to the resulting smaller domain.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2001-2009 M. D. Evans All Rights Reserved 2 Attributes: collection of elements in table size access function ??
Background image of page 2
2001-2009 M. D. Evans All Rights Reserved 3 Example: 1-dim array - subset of integers provides index set. - ordinal value of integer maps to a specific location in array. Note: 1. Array is a table; but in general case is the implementational tool for lists and tables as it possesses both sequencing & mapping characteristics. 2. ‘Positioning’ can be important in some tables. Athens Greece 2.1 * 10 6 London England 7 Rome Italy 2.9 Vancouver Canada 0.5 where the ‘look up’ operation is the key abstract operation, but is facilitated by the positioning.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2001-2009 M. D. Evans All Rights Reserved 4 Applications: mileage charts sports leagues’ statistics compiler design – symbol table (see Berman’s ch on tables)
Background image of page 4
2001-2009 M. D. Evans All Rights Reserved 5 6.2 Rectangular Tables: 6.2.1 Introduction: Def: An array is a collection of elements identified by an index set, a store opn that defines a mapping from the index set to the elements, and a retrieve opn that utilizes this mapping to obtain a stored element. Note: - an array is a data structure – nothing said about its impl n . - a programming tool available to build general tables. (analogous to linked lists building stacks!) We study: 1–dim arrays 2–dim arrays tables – special forms
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2001-2009 M. D. Evans All Rights Reserved 6 6.2.2 Implementation of 1-dim Arrays: array compiler mapping physical storage x[1] base x[2] base + 1 offset x[3] base + 2 offests when done ? – upon block activation Note: - compiler calculates relative addresses. - O.S. maps relative addr. to physical addr. Example:
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 29

ch6 - Ch. 6 Tables: 6.1 Introduction: lists sequence...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online