Please enable JavaScript.
Coggle requires JavaScript to display documents.
Data Types, Tuple type - Coggle Diagram
Data Types
Types
List type
Union type
Primitive data types
Boolean
Info
True may be 1 or -1 or any other non-zero value
False is 0
Single bit can be used
Can have either true or false
About
Logical data type
Represents true and false
Introduced in Algol 60
Simplest data type
Character
Most commonly used
8-bit ascii
Iso 8859-1
Unicode
Single character as value
Stored as numeric codes
Numeric
Integers
Storage representation
Unsigned
Signed
Two's complement
Sign magnitude
One's complement
Operations on integer data
Arithmetic
Binary
Unary
Relation
Assignment
Bit operation
Floating point
Types
Float
Standard size usually 4 bytes
Double
2x space of float
IEEE floating point standard 754
Issues
Loss of accuracy
Larger range
Representation
Computer
Exponent & mantissa
Complex
User defined ordinal types
Enumeration
Constantly implicitly start from 0,1 but can be reassigned
Ordered list of distinct values
Could be assigned any value
rarely intended
no type checking
Advantages
No arithmetic operations
Enhanced Readability
Associative arrays
Array type
Info
.
Data elements have pre defined type
element is identified by its position
Array Types
Static Array
statically bound and static allocation
Size known at compile time
Fixed Stack- Dynamic Array
Space Efficient
Size known at compile time
Fixed Heap Dynamic
Binding done during request
Allocated from heap which is longer than stack
Heap Dynamic Array
Binding is dynamic in heap
Dimension
One dimensional arrays
Value can be computed if statically bounded
Can be accessed by using the function
Two dimensional arrays
row major order
address is base address of structure
Multi dimensional arrays
Associativity array
issue is the form of references to their elements.
Rectangular and Jagged Array
Rectangular array
All rows have same number and all coloumns too
Jagged Array
Lengths no need to be same
Character string type
Regular Expressions
About
Describe Text patterns
Characters have own syntax
aka
regexp
regex
matching text done by Regex Engine
Basic Elements
Position indicators
Character sets
Quantifiers
Character sets
Character classes
[xy] - x or y
[a-z] - a or b or ……z
etc.
Quantifiers
Specify repetition
generally applies to preceded item
Design choices
String length
Limited dynamic length strings
Linked list
Complex operations
But simpler allocation and deallocation
Adjacent storage cells
Faster operations
Less storage required
But not practical with increasing string size
Pointer array
Faster than linked list
Extra memory
Pointer and reference type
Tuple Type
Tuple type