{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Ch2 - C PlusDataStructures Nell Dale Chapter 2 Data Design...

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

View Full Document Right Arrow Icon
1 C++ Plus Data Structures Nell Dale Chapter 2 Data Design and Implementation Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus
Background image of page 1

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

View Full Document Right Arrow Icon
2 Data Abstraction Separation of a data type’s logical properties from its implementation. LOGICAL PROPERTIES IMPLEMENTATION What are the possible values? How can this be done in C++? What operations will be needed? How can data types be used?
Background image of page 2
3 APPLICATION 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 REPRESENTATION Data Encapsulation is the separation of the representation of data from the applications that use the data at a logical level; a programming language feature that enforces information hiding. int y; y = 25;
Background image of page 3

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

View Full Document Right Arrow Icon
4 Encapsulated C++ Data Type int Value range: INT_MIN . . INT_MAX Operations: + prefix - prefix + infix - infix * infix / infix % infix Relational Operators infix TYPE int (inside) Representation of int as 16 bits two’s complement + Implementation of Operations
Background image of page 4
5 Abstract Data Type (ADT) A data type whose properties (domain and operations) are specified independently of any particular implementation.
Background image of page 5

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

View Full Document Right Arrow Icon
6 Application (or user) level: modeling real-life data in a specific context. Logical (or ADT) level: abstract view of the domain and operations. WHAT Implementation level: specific representation of the structure to hold the data items, and the coding for operations. HOW Data from 3 different levels
Background image of page 6
7 Viewing a library from 3 different levels Application (or user) level: Library of Congress, or Baltimore County Public Library. Logical (or ADT) level: domain is a collection of books; operations include: check book out, check book in, pay fine, reserve a book. Implementation level: representation of the structure to hold the “books”, and the coding for operations.
Background image of page 7

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

View Full Document Right Arrow Icon
8 Composite Data Type A composite data type is a type which stores a collection of individual data components under one variable name, and allows the individual data components to be accessed.
Background image of page 8
4 Basic Kinds of ADT Operations Constructor -- creates a new instance (object) of an ADT. Transformer -- changes the state of one or more of the data values of an instance. Observer -- allows us to observe the state of one or more of the data values without changing them. Iterator -- allows us to process all the components in a data structure sequentially. 9
Background image of page 9

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

View Full Document Right Arrow Icon
Two Forms of Composite Data Types Components are not organized with respect to one another. The organization determines method used to access individual data components. UNSTRUCTURED STRUCTURED EXAMPLES: EXAMPLES: arrays classes and structs 10
Background image of page 10
11 C++ Built-In Data Types C++ Built-In Data Types Composite array struct union class Address pointer reference Simple Integral Floating char short int long enum float double long double
Background image of page 11

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

View Full Document Right Arrow Icon
12 Records A record is a composite data type made up of a finite collection of not necessarily homogeneous elements called members or fields . For example . . .
Background image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}