Basic Terminologies: Elementary Data Organization
1. Introduction
Data Structures and Algorithms deal with the systematic
organization, storage, and processing of data in a computer. Before studying
advanced data structures such as stacks, queues, linked lists, trees, and
graphs, it is necessary to understand the basic terminology used to describe
data and its organization.
Elementary Data Organization refers to the basic ways
in which individual data items and collections of data items are represented
and stored in computer memory.
2. Data
Data is a collection of raw facts, figures, symbols,
or values that can be processed by a computer.
Examples:
- 25
- 85.5
- A
- Gopal
- 10101
- 15,
25, 35, 45
Data by itself may not convey complete meaning until it is
processed or interpreted.
Example:
The values 78, 85, 92, 88 are data representing marks, but their meaning
becomes clearer when associated with a particular student and subject.
3. Information
Information is meaningful and processed data that can
be used for understanding or decision-making.
For example:
Raw data: 78, 85, 92, 88
After processing:
"The student obtained an average mark of 85.75."
Thus:
Data → Processing → Information
Data is the input, while information is generally the
meaningful output obtained after processing the data.
4. Data Item
A data item is a single unit of data that represents
a particular value or attribute.
Examples:
- Roll
number = 101
- Name
= "Rahul"
- Age
= 20
- Marks
= 85.5
A data item may be elementary (atomic) or composite.
Elementary Data Item
An elementary data item cannot normally be divided into
smaller meaningful components for the intended application.
Example:
int age = 20;
Here, age is an elementary data item.
Composite Data Item
A composite data item consists of multiple related data
items.
For example, a student's record may contain:
Roll Number
Name
Age
Marks
Together, these form a composite representation of a
student.
5. Data Type
A data type specifies the kind of value that a
variable can store and the operations that can be performed on that value.
In C, commonly used data types include:
|
Data Type |
Typical Example |
|
char |
'A' |
|
int |
25 |
|
float |
3.14 |
|
double |
25.6789 |
For example:
int age = 20;
float percentage = 82.5;
char grade = 'A';
The data type determines how the compiler interprets and
stores the value.
6. Variable
A variable is a named memory location used to store a
value that may change during program execution.
Example:
int marks = 85;
Here:
- int
→ data type
- marks
→ variable name
- 85 →
value
Conceptually, memory can be represented as:
The exact memory address and size depend on the system and
compiler.
7. Elementary Data Organization
Elementary data organization deals with the representation
and storage of basic data items in memory.
The simplest forms include:
- Single
data item / variable
- Array
- Structure
- Other
composite representations built from these basic forms
The objective is to organize data so that it can be stored,
accessed, processed, and modified efficiently.
8. Array
An array is a collection of elements of the same data
type stored in logically consecutive memory locations.
Example:
int marks[5] = {85, 90, 78, 92, 88};
The array contains five integer elements:
|
Index |
Value |
|
0 |
85 |
|
1 |
90 |
|
2 |
78 |
|
3 |
92 |
|
4 |
88 |
The elements are accessed using an index.
printf("%d", marks[2]);
Output:
78
For an array, direct access using an index is efficient
because the address of an element can be calculated from its index.
For a one-dimensional array:
where:
- LOC(A[i])
= address of element A[i]
- Base(A)
= address of the first element
- i =
index
- w =
size of each element in bytes
9. Record
A record is a collection of related data items
describing a particular entity.
For example, a student record may contain:
Roll Number
Name
Branch
Semester
Marks
In C, a record can be represented using a structure.
struct Student
{
int rollNo;
char name[30];
float marks;
};
A structure allows different types of data to be grouped
under one name.
10. Field
A field is an individual attribute or component of a
record.
For:
struct Student
{
int rollNo;
char name[30];
float marks;
};
the fields are:
- rollNo
- name
- marks
Each field represents a particular characteristic of the
student.
11. File
A file is a collection of related records stored on
secondary storage such as an SSD or hard disk.
For example, a student file may contain:
|
Roll No. |
Name |
Marks |
|
101 |
Amit |
85 |
|
102 |
Ravi |
78 |
|
103 |
Neha |
91 |
Here, each row can be considered a record, while the
columns represent fields.
Thus, a simplified organization is:
Data Item → Field → Record → File
This hierarchy is useful for understanding how larger
collections of data are organized.
12. Key
A key is a data item or combination of data items
used to identify or locate a record.
For example, in a student database:
Roll Number = 101
may be used as the key for identifying a particular student
record.
A good key should allow records to be identified efficiently
and, when required, uniquely.
13. Data Structure
A data structure is a systematic way of organizing
and storing data so that operations such as accessing, inserting, deleting,
searching, and sorting can be performed efficiently.
Examples include:
- Array
- Linked
List
- Stack
- Queue
- Tree
- Graph
- Hash
Table
Data structures can broadly be classified as:
Primitive Data Structures
- Integer
- Character
- Float
- Pointer,
etc.
Non-Primitive Data Structures
- Array
- Linked
List
- Stack
- Queue
- Tree
- Graph,
etc.
14. Abstract Data Type (ADT)
An Abstract Data Type (ADT) describes a data
structure in terms of:
- the
data it represents, and
- the
operations that can be performed on that data,
without specifying the internal implementation.
For example, a Stack ADT supports operations such as:
- push()
- pop()
- peek()
A stack may be implemented using either an array or a linked
list. The ADT focuses on what operations are available, rather than
exactly how they are implemented.
15. Data Organization and Memory
Data organization is closely related to memory organization.
A computer stores data in memory locations identified by
addresses. The organization selected determines how easily and efficiently data
can be accessed.
For example:
- A variable
stores a single value.
- An array
stores multiple homogeneous values.
- A structure
groups related heterogeneous values.
- A linked
list connects dynamically allocated nodes.
- A tree
represents hierarchical relationships.
- A graph
represents relationships between entities.
16. Important Terminology at a Glance
|
Term |
Meaning |
|
Data |
Raw facts and values |
|
Information |
Processed and meaningful data |
|
Data Item |
A single unit of data |
|
Data Type |
Specifies the type of value stored |
|
Variable |
Named memory location |
|
Field |
Individual component of a record |
|
Record |
Collection of related fields |
|
File |
Collection of related records |
|
Key |
Data used to identify a record |
|
Array |
Collection of similar elements |
|
Data Structure |
Organized representation of data |
|
ADT |
Logical description of data and its operations |
17. Example: Student Data Organization
Consider the following student:
Roll No. : 101
Name : Ankit
Branch : CSE
Marks : 86.5
This can be viewed hierarchically as:
Student → Record → Fields → Individual Data Items
In C:
struct Student
{
int rollNo;
char name[30];
char branch[10];
float marks;
};
The structure provides an elementary mechanism for
organizing related information about one entity.
18. Important Points for Examination
- Data
represents raw facts and values.
- Information
is processed and meaningful data.
- A data
item represents a single unit of data.
- A variable
represents a named memory location.
- An array
stores elements of the same data type.
- A record
contains related fields describing an entity.
- A field
is an individual component of a record.
- A file
is a collection of related records.
- A key
helps identify or locate a record.
- A data
structure organizes data for efficient processing.
- An ADT
specifies data and operations independently of implementation.
Summary
Elementary data organization forms the foundation for the
study of Data Structures and Algorithms. Data is represented using basic data
types and variables and can be organized into arrays, records, files, and more
sophisticated data structures. Understanding concepts such as data item,
field, record, key, array, variable, and data structure is essential before
studying advanced structures such as linked lists, stacks, queues, trees, and
graphs.
No comments:
Post a Comment