7.4 Arrays Flashcards Preview

지시엣이 Computer Science > 7.4 Arrays > Flashcards

Flashcards in 7.4 Arrays Deck (10)
Loading 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

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

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
4
Q

Function to get length of pArray

A

len(name_of_array)

5
Q

Function to add items in an pArray

A

name_of_array.append(name_of_item)

6
Q

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

A

name_of_array[index]

7
Q

How to delete a value at a pArray with the index

A

del pArray[index]

8
Q

Linear search procedure for a pArray

A

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

9
Q

Advantages of arrays

A

Easier to utilise and sort out data

10
Q

Dimensional arrays

A

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