lists and linked lists Flashcards
What is the definition of a list?
A data structure consisting of a number of items in which the items can occur more than once.
What are the main differences between arrays and lists?
- Lists can store data non-contiguously whereas arrays store data in order.
- Lists can store data of more than one data type.
What is a tuple?
An immutable, ordered set of values of any type.
What is the difference between a tuple and an array?
Tuples are initialised using regular brackets instead of square brackets.
What is a linked list?
a list where each item contains the data Contiguously with a pointer to the next item.
there may be an additional pointer to the previous item
this means that the items can be accessed in order even if they are not stored in order
What is the name given to the items in a linked list?
Nodes
What does each item in a linked list contain?
t contains a data field and another address field called a link/pointer
What is a data field in a linked list?
A field that stores the actual data.
What is a pointer field in a linked list?
A field that contains the address of the next item in the list.