data files ? ? ? ?. data processing: in main memory economic problems -> big size data ->...
TRANSCRIPT
![Page 1: Data files ? ? ? ?. Data processing: in main memory Economic problems -> big size data -> stored in external memory Organization (identification,](https://reader035.vdocuments.mx/reader035/viewer/2022062518/56649e205503460f94b0bad4/html5/thumbnails/1.jpg)
Algorithms and programing techniques
Data files
? ??
?
![Page 2: Data files ? ? ? ?. Data processing: in main memory Economic problems -> big size data -> stored in external memory Organization (identification,](https://reader035.vdocuments.mx/reader035/viewer/2022062518/56649e205503460f94b0bad4/html5/thumbnails/2.jpg)
Data files
Data processing: in main memory Economic problems -> big size data -> stored in
external memory
Organization (identification, classification, description, representation etc.) internal external: logical / physical transformation (during I/E operations)
Concepts file and record organization methods and access types processing operations
![Page 3: Data files ? ? ? ?. Data processing: in main memory Economic problems -> big size data -> stored in external memory Organization (identification,](https://reader035.vdocuments.mx/reader035/viewer/2022062518/56649e205503460f94b0bad4/html5/thumbnails/3.jpg)
Logical level File: external data structure
▪ linear, ordered, homogeneous (meaning and processing)▪ composed of records (equal or varied length)
Record: data structure concerning one entity▪ inhomogeneous, ordered▪ composed of fields
Physical level File: OS records, actual data: flow of bytes, no inherent
meaning Representation: text, binary
A0 A1 A2 A3 An......
FileFile
RecordRecord
End of record marker
End of record marker
End of file marker
End of file marker
File and record
Text files: CR/LF (13, 10)Binary files: nothing
Text files: EOF (27, CTRL-Z)Binary files: nothing
![Page 4: Data files ? ? ? ?. Data processing: in main memory Economic problems -> big size data -> stored in external memory Organization (identification,](https://reader035.vdocuments.mx/reader035/viewer/2022062518/56649e205503460f94b0bad4/html5/thumbnails/4.jpg)
File and record
Transfer between external storage and internal memory read / write record level: adequate descriptions and operations
Internal record structure fixed structure struct variable structure union fixed part + variable part struct + union
Internal memory
/E
File buffer areaArt.i Art.i+1 Art.i+2 ... Art.i+kFile
I/
XInternal variableCurrent
position
Accesible memory
![Page 5: Data files ? ? ? ?. Data processing: in main memory Economic problems -> big size data -> stored in external memory Organization (identification,](https://reader035.vdocuments.mx/reader035/viewer/2022062518/56649e205503460f94b0bad4/html5/thumbnails/5.jpg)
Organization methods and access types
Organization method Principles and rules protection and
retrieval▪ sequential▪ relative▪ indexed▪ etc. (selective, reversed, linked, multi-indexed …)
Access types A way of finding records inside a file▪ sequential▪ direct (by relative number / key)
![Page 6: Data files ? ? ? ?. Data processing: in main memory Economic problems -> big size data -> stored in external memory Organization (identification,](https://reader035.vdocuments.mx/reader035/viewer/2022062518/56649e205503460f94b0bad4/html5/thumbnails/6.jpg)
Sequential access
Implemented in all languages ,
Detect the end of file?
A0 A1 ... Ak-1 Ak ... An EOF
P( Ak ) = f( P(Ak-1) )
Traversing
A0 A1 ... Ak-1 Ak ... An EOF
Pointer position after reading the last record
![Page 7: Data files ? ? ? ?. Data processing: in main memory Economic problems -> big size data -> stored in external memory Organization (identification,](https://reader035.vdocuments.mx/reader035/viewer/2022062518/56649e205503460f94b0bad4/html5/thumbnails/7.jpg)
Direct access by relative number
Implemented in some languages (Pascal/Delphi, Cobol)
00 11 ...... k-1k-1 kk ...... nn
A0 A1 ... Ak-1 Ak ... An EOF
Direct access by relative number kP( Ak ) = k * lart
Relative number
![Page 8: Data files ? ? ? ?. Data processing: in main memory Economic problems -> big size data -> stored in external memory Organization (identification,](https://reader035.vdocuments.mx/reader035/viewer/2022062518/56649e205503460f94b0bad4/html5/thumbnails/8.jpg)
Direct access by key
Implemented in some languages (Cobol)
A0 A1 ... Ak-1 Ak ... An EOF
Direct access by the key of record kP( Ak ) = f(cheiek)
![Page 9: Data files ? ? ? ?. Data processing: in main memory Economic problems -> big size data -> stored in external memory Organization (identification,](https://reader035.vdocuments.mx/reader035/viewer/2022062518/56649e205503460f94b0bad4/html5/thumbnails/9.jpg)
Detection of end of file
Direct influence on design of algorithms
By reading (Fortran, Cobol, C) Depicted position IS NOT considered end of file
Read-independent (Basic, Pascal/Delphi) Depicted position IS considered end of file
A0 A1 ... Ak-1 Ak ... An EOF
Pointer position after reading last record
![Page 10: Data files ? ? ? ?. Data processing: in main memory Economic problems -> big size data -> stored in external memory Organization (identification,](https://reader035.vdocuments.mx/reader035/viewer/2022062518/56649e205503460f94b0bad4/html5/thumbnails/10.jpg)
Sequential organization
Sequentially organized file same / varied length records records are stored in the order they were added access types: sequential, direct (depending on file support) examples: text file (varied length records), binary data files (same length
records)
Art.1 Art.2 Art.3 Art.4 ... Art.i ... Art.n
File starts here
Records
End of record markers (physical / logical)
End of file marker
![Page 11: Data files ? ? ? ?. Data processing: in main memory Economic problems -> big size data -> stored in external memory Organization (identification,](https://reader035.vdocuments.mx/reader035/viewer/2022062518/56649e205503460f94b0bad4/html5/thumbnails/11.jpg)
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Free spaces
Valid records
Relative organization
Relative organized file same length records relative key: numerical, domain of values records are stored at the position indicated by the key biunivocal
relationship▪ free spaces, valid records
access types: sequential, direct (relative key relative number) examples: binary data files
![Page 12: Data files ? ? ? ?. Data processing: in main memory Economic problems -> big size data -> stored in external memory Organization (identification,](https://reader035.vdocuments.mx/reader035/viewer/2022062518/56649e205503460f94b0bad4/html5/thumbnails/12.jpg)
Indexed organization
Indexed file two physical files: index file, data file (sequential) same length records alphanumerical keys records are stored in the data file in the order they were added Access types: sequential, direct (key)
Index file
Data file0 1 2 3 4 5 6 7 8 9 10 11 12 13
3 - aaaa 6 - aaab 0 - aaac 12 - aaba 8 - abaa 13 - abba 4 - baaa 7 - baca
![Page 13: Data files ? ? ? ?. Data processing: in main memory Economic problems -> big size data -> stored in external memory Organization (identification,](https://reader035.vdocuments.mx/reader035/viewer/2022062518/56649e205503460f94b0bad4/html5/thumbnails/13.jpg)
Processing operations
File level gain access (open) end acces (close) File must be closed delete rename etc.
Record level File must be open populate add record(s) retrieve record(s) modify record(s) delete record(s)
Basic operations read / write with / without conversion
Homework: subchapters 2.1,2.2,2.3, 2.4
![Page 14: Data files ? ? ? ?. Data processing: in main memory Economic problems -> big size data -> stored in external memory Organization (identification,](https://reader035.vdocuments.mx/reader035/viewer/2022062518/56649e205503460f94b0bad4/html5/thumbnails/14.jpg)
Spor la învăţat!