[Unit 1.4.2] Data Structures Flashcards
data structures
define “data structure”
collection of data organised for efficient processing
define “primitive data types”
single values (integers/floats)
define “compound data types”
combine primitive data types (records/dates)
what is a linear data structure
ordering data in a sequential order. each element is connected to the one before and after.
what is a non linear data structure
data organised with a hierarchy like a family tree
what are the two types of linear data structures
static:
fixed size, change content. memory allocated at compiler time
Dynamic:
change size, change content. memory allocated during run time as needed.
what are records
data structures consists of fixed number of attributes (fields/columns)
three similarities between records and OOP
-bundle related properties together
-define attributes (to manipulate data)
-can have multiple instances
four differences between records and OOP
-record is data structure. class is template for data structure
-classes have methods
-classes can change visibility of properties
-classes have inheritance
what are the features of an array
same data type
static
stored contiguously
mutable
what are the features of a list
different data types
dynamic
stored contiguously
mutable
what are the features of a tuple
different data types
static
immutable
what are the features of a linked list
dynamic
data does not have to be stored contiguously
each item is called a node
what two features is a node comprised of
data and pointer
what is the pointer in a node
contains the address of the next node
what does it mean if a pointer is null
end of linked list
node not linked to another (if one has been deleted)
what is the head pointer (linked lists)
points to location of first node
what is the free space pointer and what does it mean if it is null (linked lists)
indicates next free element (if null then list is full)
what is the tail pointer (linked lists)
indicates location of last node
what are the three types of linked lists
single linked
doubly linked
circular linked
what is a single linked list
navigation is forwards only
what is a doubly linked list
navigation can be forwards or backwards
(must have two pointers (previous&next))
what is a circular linked list
last node links to first node.
can be single linked or doubly linked.
differences between array and linked list (4)
accessing data faster in array
uses less memory per item in array
array is static data structure
slow to add/remove data in array