0% found this document useful (0 votes)
42 views

2.1. Data Structures and Abstract Data Types

This document discusses key concepts for AQA Computer Science AS-Level specification section 3.2.1, including data structures, arrays, fields, records and files. It defines data structures as containers for storing information and explains that different structures suit different data types. Arrays are introduced as indexed sets of related elements that must contain the same data type. Both single- and multi-dimensional arrays are described. The document also notes that information is stored in files as records composed of fields and that reading and writing files is important.

Uploaded by

Trevor Chad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

2.1. Data Structures and Abstract Data Types

This document discusses key concepts for AQA Computer Science AS-Level specification section 3.2.1, including data structures, arrays, fields, records and files. It defines data structures as containers for storing information and explains that different structures suit different data types. Arrays are introduced as indexed sets of related elements that must contain the same data type. Both single- and multi-dimensional arrays are described. The document also notes that information is stored in files as records composed of fields and that reading and writing files is important.

Uploaded by

Trevor Chad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

AQA Computer Science AS-Level

3.2.1 Data structures and


abstract data types
Advanced Notes

www.pmt.education
Specification:

3.2.1.1 Data structures:


Be familiar with the concept of data structures.
3.2.1.2 Single- and multi-dimensional arrays (or equivalent):
Use arrays (or equivalent) in the design of solutions to simple problems.
3.2.1.3 Fields, records and files:
Be able to read/write from/to a text file.
Be able to read/write data from/to a binary (non-text) file.

www.pmt.education
Data structures

Data structures are used by computers as the ​containers​ within which information is
stored. Different data structures exist and some are better suited to​ different types of data
than others. When storing data, a programmer must decide which of the data structures
available is the best to use.

Arrays

An array is an​ indexed set of related elements​. An array must


be ​finite​, ​indexed​ and must only contain elements with the
same​ data type​.

Array Names = {“George”, “Sue”, “Mo”} 


 
The elements of an array are given an ​index​, which often
starts from zero​. For example, with the array shown above,
Names(2)​would return ​“Mo”​as the first item (​“George”​ ) is
given the index ​0​.

The array shown above is a ​one-dimensional array​ which could be visualised with the
following table:

0  1  2 

“George”  “Sue”  “Mo” 

Arrays can be created in ​many dimensions​. For example, a two-dimensional array could
look like this:

Array Maze = { {Wall, Path, Wall}, {Path, Path, Wall}, {Wall, Path, Wall}} 
 
When displayed in a ​table​, the ​Maze​array starts to make a little more sense: 

  0  1  2  When an individual element is referenced,


the ​x​coordinate is listed first​.
0  Wall  Path  Wall 
For example, ​Maze(1,2)​would return
1  Path  Path  Wall 
Path​and ​Maze(2,1)​would return ​Wall​
.
2  Wall  Path  Wall 

www.pmt.education
Fields, records and files

Information is stored by computers as a ​series of files​. Each file is made up of ​records


which are composed of a number of ​fields​.

It’s important that you make sure you can write to and read from files in your chosen
programming language.

www.pmt.education

You might also like