[PDF] Unit 1 & 2: Data Structures AS Computer Science - WJEC




Loading...







[PDF] Unit 1 & 2: Data Structures AS Computer Science - WJEC

Data structures A data structure is a specific way of organising data within memory so it can be processed efficiently Arrays An array is a data structure 

[PDF] What is a Data Structure? - Amazon AWS

Linear: A data structure is said to be linear if its elements form a sequence or a linear list Examples: Array Linked List, Stacks and Queues

[PDF] LECTURE NOTES ON DATA STRUCTURES - IARE

A data structure is a way of storing data in a computer so that it can be used efficiently and it will allow the most efficient algorithm to be used

[PDF] Introduction to Data Structures and Algorithms

Data structure is a branch of computer science The study of data structure From the above definition, it is clear that the operations in data structure

[PDF] Master of Computer Applications DATA STRUCTURE THROUGH C

define abstract data types 1 2 INTRODUCTION A data structure in Computer Science, is a way of storing and organizing data in a computer's memory or even 

[PDF] Data Structures and Algorithms - School of Computer Science

We will typically use = in its mathematical meaning, unless it is written as part of code or pseudocode We say that the individual items a[i] in the array a 

[PDF] Data Structures Lecture 1: Introduction - Computer Science

class Dictionary { Dictionary(); void insert(int x, int y); void delete(int x); } Page 10 Dictionary ADT • Most basic and most useful ADT:

[PDF] DATA STRUCTURES USING “C” - CET

Reference Books: 1 “Fundamentals of data structure in C” Horowitz, Sahani Freed, Computer Science Press 2 “Fundamental 

[PDF] Data Structure

25 oct 2021 · College of Science Data Structure Definition • In computer science, a data structure is a particular way of storing and organizing data 

[PDF] Unit 1 & 2: Data Structures AS Computer Science - WJEC 71773_3wjec_ko_data_structures_v2.pdf

Unit 1 & 2: Data StructuresAS Computer Science

TermDefinition

Data structuresA data structure is a specific way of organising data within memory so it can be processed e?ciently.

ArraysAn array is a data structure that

contains groups of elements.

Normally these elements are all

of the same data type.

RecordsRecords are composed of fields,

each of which contains one item of information about the same subject, e.g. one person. A set of records constitutes a file.One-dimensional array example [ 0 ]

37114262656476

[ 1 ][ 2 ][ 3 ][ 4 ][ 5 ][ 6 ][ 7 ]• 8 elements • The index always starts at position . • Each element can be accessed using its index. • The element at index is 26.

Two-dimensional array example:Indexij

0FredSmith

1JohnDavies

2SueEvans

3PamelaWilson

• 4 elements • The index always starts at 0. • Each element can be accessed using its index. • The element at index [1,2] is Davies. • The element at index [3,1] is Pamela.

Traversing

Print the contents of the array above:

1 for j = 1 to 2for i = 0 to 3 output myArray [i, j] next j next i2 3 4

5Insertion

Add data to an element at a given index:

myArray [4,2] = "Jones"myArray [4,1] = "Sian" 1 2

This would store "Sian Jones" at index 4 of the

array.

Deletion

Deleting data from an element at a given index:

myArray [1,2] = ""myArray[1,1] = "" 1 2

This would leave the memory at index 6 blank.

Data types include:

• integer: whole numbers, e.g. 10, 23 • real: numbers with decimal or fractional parts, e.g. 3.142, 99.9 • character: individual characters, e.g. M, F • string: series of characters, e.g. Fred, Smith • Boolean: e.g. TRUE or FALSE Arrays normally include elements of the same data type. Records include a mixture of data types.Arrays are data structures comprising a collection of elements (values or variables). Each element is referenced by an index.

Arrays can be used to search for a data item

from a list. The data from the file can be read into an array and then the data can be searched using the index until the required item is found.Declare linearSearch(dataList, searchItem) position = 0 found = false while position < len(dataList) and found = false end while testList = [1,3,21,45,57,17,34,65] linearSearch(testList, 45) linearSearch(testList, 20) if dataList[position] = searchItem then found = true position = position + 1 else end if

Data types

Arrays

Using an array to search data

Unit 1 & 2: Data StructuresAS Computer Science

Data can be written to a file via the computer

user interface. pupilID= pupilID.txt firstname = firstname.txt surname = surname.txt form = form.txt

DoB = DoB.txt

file.open ("PupilDetails.txt") file.write (pupilID + firstname + surname + form+ DoB) details successfully saved") file.close() messagebox("Confirmation","Pupil

A record is a group of related data held

within the same structure. A record is a grouping of fields within a table that reference one particular object.

An example of the structure of a pupil record

is:

FieldnameData

typeLengthExample

PupilIDString5P0001

FirstnameString20Fred

SurnameString20Smith

House NoInteger10

PostcodeString8CF62 6YX

GenderCharacter1M

AttendanceReal94.3

A record comprises multiple data types.

Each record will be of the same structure

(same fields).

Each record will have a key field which will

be a unique identifier for that record. In general, searches will be carried out on the key field.

When data records are read from a file, they

can be read into a two-dimensional array to allow them to be manipulated (searched or sorted). Each record in a file can be of a dierent length which will be dependent on the length of the data to be stored in that record. Each field is separated from other fields by special characters known as delimiters. Variable length records save storage space but are more dicult to manipulate through code. Fixed length records can take up considerable space which is used to store padding. However, as the length of each record is known, they are easier to manipulate when programming. There are two main types of records; fixed length and variable length records. Each record in a file will be the same length with the size of each field remaining consistent. The Pupil records will all have pupilIDs that are 5 characters in length with the same format P9999. The firstname field has been set at 20 characters. If a pupil"s name is shorter that 20 characters a series of blanks (padding) will be stored in that field, e.g. if Fred is stored in a record, there will be four characters and

16 blanks.

Records

Reading data records from a file

Variable length records

Advantages and disadvantages of fixed and variable length records

Fixed and variable records

Fixed length records

Writing data records to a file


Politique de confidentialité -Privacy policy