Download presentation
Presentation is loading. Please wait.
Published byBruce Heath Modified over 9 years ago
1
3 Data
2
Software And Data Data Data element – a single, meaningful unit of data. Name Social Security Number Data structure – a set of related data elements. – list, queue, linked list, array, stack, file
3
Fig. 3.18: The most basic data structure is a list. Each entry is called a node, and each node contains a single data element.
4
Fig. 3.19: In a linked list, each node contains data plus a pointer to the next node. The data items need not be stored in adjacent memory locations because the pointers define the list’s logical order.
5
Fig. 3.20: To insert a node into a linked list, locate the prior node, change its pointer to the new node, and set the new node’s pointer to the next node.
6
Fig. 3.21: To delete a node from a linked list, change the appropriate pointer to “jump over” the deleted node.
7
Fig. 3.22a: A stack is a linked list in which all insertions and deletions occur at the top. Access to the stack is controlled by a single pointer.
8
Fig. 3.22b: Because insertions and deletions occur only at the top, the last item added to the stack is the first item removed from the stack.
9
Fig. 3.23a: A queue is a linked list in which insertions occur at the rear and deletions occur at the front.
10
Fig. 3.23b: Access to a queue is controlled by two pointers, and the first item added to a queue is the first item removed.
11
Software And Data Data Data File – The most familiar type of data structure – A set of data elements (fields) – A group of related fields (records) – A group of related records (file)
12
Fig. 3.24: Fields are grouped to form records. A file is a set of related records.
13
Software And Data Data Data File (mainframe Processing) – The data is processed record by record – Programs are written to read a record, process its fields, generate the appropriate output, and then read and process another record. – Because only one record is in memory at a time, relatively little memory is needed.
14
Fig. 3.25: A relative record number indicates a record’s position relative to the first record in the file.
15
Fig. 3.26: Given the start of file address and a relative record number, a physical disk address can be computed.
16
Software and Data Access Techniques Sequential access – accessing data in physical order. – Processing begins with relative record 0, then moves to relative record 1, 2, and so on. Direct (random) access – accessing data without regard for physical order. – Index – hashing
17
Fig. 3.27: An index can be used to convert a logical key to a relative record number.
18
Software and Data Database Management Traditional files – data redundancy – data dependency Database – centralized – single copy of each data element – programmer can ignore physical data structure
19
Fig. 3.28: Many of the problems associated with traditional data access techniques can be solved by using a database.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.