3.2.3 Data types and data structures

Slides:



Advertisements
Similar presentations
Methods of Access Serial Sequential Indexed Sequential Random Access
Advertisements

Introduction to Database Systems1 Records and Files Storage Technology: Topic 3.
Analysis of Algorithms CS Data Structures Section 2.6.
Files  File organisation and usage A record is a group of logically related fields A file is a group of logically related records Files are used to store.
23/05/20151 Data Structures Random Access Files. 223/05/2015 Learning Objectives Explain Random Access Searches. Explain the purpose and operation of.
Databases and Processing Modes. Fundamental Data Storage Concepts and Definitions What is an entity? An entity is something about which information is.
Database Design Concepts Info 1408 Lecture 2 An Introduction to Data Storage.
File Organization Techniques
Storage and Multimedia Part II Bayram Güzer. Magnetic Tape Storage It is similar to tape used in music cassettes –Plastic tape with a magnetic coating.
Data and its manifestations. Storage and Retrieval techniques.
DATA STRUCTURE & ALGORITHMS (BCS 1223) CHAPTER 8 : SEARCHING.
A Level Computing#BristolMet Session Objectives#U2 S7 MUST understand the difference between an array and record SHOULD be able to estimate the size of.
Now, please open your book to page 60, and let’s talk about chapter 9: How Data is Stored.
INFORMATION MANAGEMENT Unit 2 SO 4 Explain the advantages of using a database approach compared to using traditional file processing; Advantages including.
1 5. Abstract Data Structures & Algorithms 5.2 Static Data Structures.
# 1# 1 Creating Tables, Setting Constraints, and Datatypes What is a constraint and why do we use it? What is a datatype? What does CHAR mean? CS 105.
1/14/2005Yan Huang - CSCI5330 Database Implementation – Storage and File Structure Storage and File Structure II Some of the slides are from slides of.
Use of ICT in Data Management AS Applied ICT. Back to Contents Back to Contents.
FILE ORGANIZATION.
Switch off your Mobiles Phones or Change Profile to Silent Mode.
11-1 © Prentice Hall, 2004 Chapter 11: Physical Database Design Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
Chapter 9: Data types and data structures OCR Computing for A Level © Hodder Education 2009.
OCR AS Level F452: Data types and data structures Data types and data structures a. define different data types, eg numeric (integer, real),
OCR A Level F453: Data structures and data manipulation Data structures and data manipulation a. explain how static data structures may be.
Introduction toData structures and Algorithms
Algorithm Efficiency and Sorting
Storage and File Organization
Databases and DBMSs Todd S. Bacastow January
Databases.
Course Developer/Writer: A. J. Ikuomola
CPSC 231 Organizing Files for Performance (D.H.)
INLS 623– Database Systems II– File Structures, Indexing, and Hashing
Indexing Structures for Files and Physical Database Design
The Data Types and Data Structures
IGCSE 6 Cambridge Effectiveness of algorithms Computer Science
LEARNING OBJECTIVES O(1), O(N) and O(LogN) access times. Hashing:
Week 12 Option 3: Database Design
Starting Out with Programming Logic & Design
Chapter 1: Data Structures 1A, B
Hash Tables in C James Goerke.
The relational operators
File and Database Concepts
Database Implementation Issues
Chapter 11 – File Processing
Computer Science 2 Hashing
FILE ORGANIZATION.
Searching and Sorting Topics Sequential Search on an Unordered File
© Akhilesh Bajaj, All rights reserved.
Databases Lesson 2.
Searching and Sorting Topics Sequential Search on an Unordered File
Manipulating lists of data
Files [Computing] Computing.
Data Types & File Size Calculations
4.1 Strings ASCII & Processing Strings with the Functions
Searching and Sorting Topics Sequential Search on an Unordered File
Text / Serial / Sequential Files
Variable Length Data and Records
Files Management – The interfacing
DATABASE IMPLEMENTATION ISSUES
Random Access Files / Direct Access Files
Introduction to Data Structure
Chapter 9: More About Data, Arrays, and Files
Unit Databases.
File Organization.
Database Implementation Issues
VIJAYA PAMIDI CS 257- Sec 01 ID:102
Index Structures Consider a relation Employees (eid, name, salary, age, did) stored as a heap file (unsorted) for which the only index is an unclustered.
Database Implementation Issues
PROGRAMMING CONCEPTS CHAPTER 8
Unit 12 Index in Database 大量資料存取方法之研究 Approaches to Access/Store Large Data 楊維邦 博士 國立東華大學 資訊管理系教授.
Presentation transcript:

3.2.3 Data types and data structures OCR AS Level F452: 3.2.3 Data types and data structures 3.2.3 Data types and data structures c. explain the advantages and disadvantages of different data types and data structures for solving a given problem; d. design and implement a record format; e. define different modes of file access: serial, sequential, indexed sequential and random; and justify a suitable mode of file access for a given example; f. store, retrieve and search for data in files; g. estimate the size of a file from its structure and the number of records; h. use the facilities of a procedural language to perform file operations (opening, reading, writing, updating, inserting, appending and closing) on files of different access modes as appropriate.

OCR AS Level F452: 3.2.3 Data types and data structures c. explain the advantages and disadvantages of different data types and data structures for solving a given problem;

Selecting suitable data types OCR AS Level F452: 3.2.3 Data types and data structures Selecting suitable data types An online bingo company uses the following variables: Player name Amount won Average score Phone number What data type should each variable be and why?

d. design and implement a record format; OCR AS Level F452: 3.2.3 Data types and data structures d. design and implement a record format;

Record formats Field Name Data Type Maximum size in bytes CustomerID OCR AS Level F452: 3.2.3 Data types and data structures Record formats Field Name Data Type Maximum size in bytes CustomerID String 6 First name 10 Gender Char 1 Age Integer 2 A record is just a data structure that allows items of data of different types to be stored together in a single file. Data is stored in different fields.

OCR AS Level F452: 3.2.3 Data types and data structures e. define different modes of file access: serial, sequential, indexed sequential and random; and justify a suitable mode of file access for a given example;

OCR AS Level F452: 3.2.3 Data types and data structures Serial files In serial files records are stored in the order in which they were entered. New records are always added at the end of the file. These files are only searchable by going through each record 1 by 1 from beginning to end (serial search). First name Surname Age David King 12 George Smith 34 Matt Jones 56 Joe Apple 7 Sarah Brain 89 Last record entered First record entered.

OCR AS Level F452: 3.2.3 Data types and data structures Sequential files In sequential files records are stored sequentially according to some key field, for example alphabetically. First name Surname Age Joe Apple 7 Sarah Brain 89 Lucy Charles 13 Sam Charleston 24 Matt Jones 56 David King 12 Craig Pendlby 57 George Smith 34 Files stored sequentially by surname.

Indexed sequential files OCR AS Level F452: 3.2.3 Data types and data structures Indexed sequential files In indexed sequential files records are stored according to some key field and one or more indexes are used to make searching even more efficient. Index Sequential File First name Surname Age Joe Apple 7 Sarah Brain 89 Lucy Charles 13 Sam Charleston 24 Matt Jones 56 David King 12 Craig Pendlby 57 George Smith 34 Letter Index A 1 B 2 C 3 J 5 K 6 P 7 S 8

OCR AS Level F452: 3.2.3 Data types and data structures Random files Are files in which records have been placed in the file according to a mathematical hash algorithm. For example by generating a position based on a combination of the customers initials and DOB. These are fast to search because to find a record you just repeat the hash algorithm.

Advantages & disadvantages of file types OCR AS Level F452: 3.2.3 Data types and data structures Advantages & disadvantages of file types Advantages Disadvantages Serial Items stored in any order Take a long time to search. Sequential Items stored in a set order so they are faster to search. Inserting new items is more complicated. Indexed Sequential Very fast to find items. Every time an item is inserted the index needs updating. Random The fastest to search. Most complicated to implement.

f. store, retrieve and search for data in files; OCR AS Level F452: 3.2.3 Data types and data structures f. store, retrieve and search for data in files;

OPEN READ WRITE INSERT APPEND CLOSE OCR AS Level F452: 3.2.3 Data types and data structures Common file operations playerName = “Dave” playerScore = “500” OPEN playerscores.txt count = 0 while count<numLines(playerscores.txt) READ line(count) IF line(count) = playerName WRITE currentScore CLOSE playerscores.txt ELSE count=count+1 CLOSE playerscore.txt OPEN READ WRITE INSERT APPEND CLOSE You dont need to be able to do this in any particular language as long as you know what these basic commands do.

OCR AS Level F452: 3.2.3 Data types and data structures g. estimate the size of a file from its structure and the number of records;

Estimating the file size of records OCR AS Level F452: 3.2.3 Data types and data structures Estimating the file size of records Field Name Data Type Maximum size in bytes CustomerID String 6 First name 10 Gender Char 1 Age Integer 2 So if this file had 10 records in it it’s size would be, 6+10+1+2 to get the size of one record (19), then 19*10 for the size of all records together (190), then 190+19 to give some margin for error. So the estimated file size would be 209. Work out the size of each field Add together the size of each field to get the size of one record. Multiply by the number of records. Add 10%

OCR AS Level F452: 3.2.3 Data types and data structures h. use the facilities of a procedural language to perform file operations (opening, reading, writing, updating, inserting, appending and closing) on files of different access modes as appropriate.;