Composite Data Type
Lab: Types of Data
Video Runtime: 19:19
Composite data types are a combination of primitives and other data types. They include arrays, lists, and collections.
Your key takeaways are:
- Composite data types include arrays, lists, and collections
- Combination of primitives and other data types
- Arrays
- ordered arrangement of data
- each element
- keyed – implied or declared
- value held in the element can be any data type
Study Notes
What is a Composite Data Type?
- Combination of the primitives and other composite types
- It’s a composition of different types
Examples of Composite Data Types
- Array
- Collection
What is an Array?
An array is an ordered arrangement of data.
“Ordered arrangement of data”
Ordered | Arrangement | of Data |
---|---|---|
Ordered means there is a KEY or an INDEX that can identify each arrangement | Arrangement is a method of ORGANIZING | Data is a REPRESENTATION of information |
How can we relate Post Office Boxes to arrays?
- each has a unique number (key) to identify it
- the boxes are arranged by number and size
- they are different sizes, so when you need to handle more information (data), you just get a bigger box
Anatomy of an Array
- Key – implied or declared
- Associative Array (vs. Indexed Array)
- Element
- {level}-dimensional (e.g. 1st-dimensional, multi-dimensional)
What patterns do you see?
Indexed Array
- No keys are declared
- Just data
- Different types of data
Associative Array
- Array of arrays
- 1st dimension are not keyed
- 2nd dimension is keyed
How do I access the data in the array? Review the video if you are struggling with this as it goes into great detail.
You get WET when you swim. Stay DRY when you code.
Episodes
Total Lab Runtime: 00:48:33
- 1 Lab Introductionfree 05:36
- 2 Primitive Data Typefree 08:58
- 3 Composite Data Typefree 19:19
- 4 Special Data Typefree 03:30
- 5 Abstract Data Typefree 11:10