抖阴社区

Data structures

16 0 0
                                    


Array

-an ordered collection of data elements (data structure), accessed by index and uses a single name/identifier

-Takes up contiguous memory/storage space

Info which needs to be provided when declaring an array:

-Name/identifier

-Size (it's a static data structure)

-Number of dimensions

-Data type


Stack

Stack- is a LIFO (Last In, First Out) data structure. Data is added on the top of a stack and removed from the top, hence LIFO.

Push- to add data/ push onto a stack. First it checks the stack isn't full, then the pointer is incremented and the data inserted


Queue

A queue is a FIFO (first in first out) data structure. Data is added to the rear of the queue (enqueued) and deleted (dequeued) from the front


Record

AKA struct

A record uses one name/identifier to store multiple values in fields which can be different data types

players=("John",True,12)

recordStructure: recordname

fieldName : datatype

end recordStructure


Lists and tuples

Lists and tuples

Oops! This image does not follow our content guidelines. To continue publishing, please remove it or upload a different image.


Dictionary

dictname={key:value, key:value}



Homogenous- the same data type

Oops! This image does not follow our content guidelines. To continue publishing, please remove it or upload a different image.

Homogenous- the same data type

Heterogenous- not

Computer Science Reviews (A level)Where stories live. Discover now