what is an array
a data structure that contains more than data item, they have to be the same data type
it is also a linear data structure as it allocates a contiguous part of memory for the purpose of storing that data
what is the difference between an array and a list
an array is a static data structure- you cannot change its size once its been set up, only 1 data type
a list is dynamic, and can store more than 1 data type
visuals for 2d arrays, 3d arrays, and 4d arrays
a table (rown, column)
a cube (height, length, depth)
multiple cubes (first index chooses the cube, height, length, depth)
what is a record structure
composite data structure that groups related fields of different data types under one identifier
it represents a single fixed entity
a field is a variable
what is special about fields, in record structures
each field can have different data types
what are the 3 steps to use a record data structure
give a list of linear data structures
arrays, records, lists (- linked lists, tuples), stacks, queues, hash table
what is a static data structure
examples ..
when data structure are in a fixed size when structure is created
and the size cannot change at run-time
e.g. arrays.
what is a dynamic data structure
examples..
a data structure thats size change during processing
it uses an area of memory called the heap
e.g. lists and linked lists
what is the problem with a dynamic data structure
examples..
as the size can change it is possible for the structure to ‘overflow’ if it exceeds the maximum allowed memory
this means the system returns an error since the memory allocation has failed and the program should detect the failure
e.g. list, linked-list
what are some dynamic data structures
lists and linked lists
what is the heap
memory set aside for dynamic allocation like dynamic data structures, objects
space is allocated and deallocated as required
what does immutable mean examples..
means the data structure does not change - static data / fixed size
elements cannot be added, removed or changed .e.g. tuples
define data structure
what are the two types of data structures
a particular way of storing and organising related data in a way that utilises it in an efficient manner
-linear and non linear data structures
define a linear data structure
the elements are stored sequentially, and the elements are connected to the previous and the next element, so they can be traversed or accessed in a single run
the implementation of linear data structures is easier as the elements are sequentially organized in memory
define non linear data structure
when data elements are not arranged in a contiguous manner, since the arrangement is nonsequential, so the data elements cannot be traversed or accessed in a single run
in the non-linear data structure, an element can be connected to more than two elements
what are 3 traits of tuples
what are 4 traits of records
what are 3 traits of arrays