7.4 Arrays Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Array (strict data structure)

A

A data structure that allows you to hold many items of data which is referenced by one identifier

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Array rules (strict data structure)

A
  • All items of must be of the same datatype

- An array’s size is declared during initialisation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Python Array

A
  • There is no such “array” but list (for the rest of the cards pArray)
  • A list can store any data type without the size being defined during initialisation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Function to get length of pArray

A

len(name_of_array)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Function to add items in an pArray

A

name_of_array.append(name_of_item)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Function to get the value held at that position in a pArray

A

name_of_array[index]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to delete a value at a pArray with the index

A

del pArray[index]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Linear search procedure for a pArray

A

for i in pArray:
if item == i:
(do whatever)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Advantages of arrays

A

Easier to utilise and sort out data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Dimensional arrays

A

Arrays can have different dimensions, so there can be 2D and 3D arrays (arrays inside of arrays)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly