1.4.2 - data structures Flashcards
7
one dimensional array
A finite, ordered set of elements of the same type stored in contiguous memory.
Does row or column come first in 2D array?
row
tuple
An immutable, ordered set of values of any data type.
immutable
Its elements cannot be changed and you cannot dynamically add or delete elements from a tuple.
record
Contains a number of fields, each holding one item of data.
list
A contiguously stored data structure consisting of a number of ordered items where the items can occur more than once.
list.isEmpty()
Test for an empty list.
list.append(item)
Adds item to the end of a list.
remove(item)
Removes the first occurrence of an item from a list.
search(item)
Return whether an item exits in a list or not.
list.length()
Returns number of items in a list.
list.index(item)
Returns the position of item.
list.insert(position, item)
Insert a new item at position.
list.pop()
Remove and return the last item in the list.
list.pop(position)
Remove and return the item at position.