









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Data
Data are simply values or sets of values, raw materials used as inputs.
A data item refers to a single unit of values.
Data items that are divided into sub items are group items. Those that are not
are called elementary items. For example, a student’s name may be divided
into three sub items – [first name, middle name and last name] but the ID of a
student would normally be treated as a single item.
Student
ID Name Address Age Gender
First Middle Last Street Area
Data are organized into the hierarchy of fields, records and files that
reflects the relationship between attributes, entities and entity sets.
Field
A field is a single elementary unit of information representing an attribute
of an entity.
Record
A record is the collection of field values of a given entity.
File
A file is the collection of records of the entities in a given entity set.
Information
Information is sometimes used for data with given attributes, or, in other
words meaningful or processed data. A field is a single elementary unit of
information representing an attribute of an entity.
Data Structure
In computer science, a data structure is a particular way of storing and
organizing data in a computer’s memory so that it can be used efficiently. Data
may be organized in many different ways; the logical or mathematical model
of a particular organization of data is called a data structure.
The choice of a particular data model depends on the two considerations
first; it must be rich enough in structure to mirror the actual relationships of
the data in the real world. On the other hand, the structure should be simple
enough that one can effectively process the data whenever necessary.
Categories of Data Structures
Data structures can be classified in to major types:
Linear Data Structures
Non-linear Data Structures
Linear Data Structure
A data structure is said to be linear if its elements form any sequence.
There are basically two ways of representing such linear structure in memory.
a) One way is to have the linear relationships between the elements
represented by means of sequential memory location. These linear structures
are called arrays.
b) The other way is to have the linear relationship between the elements
represented by means of pointers or links. These linear structures are called
linked lists.
Linear Data Structure
Common examples of linear data structure are:
Arrays
Queues
Stacks
Linked lists
Data Structures Operations
The data appearing in our data structures are processed by means of
certain operations. In fact, the particular data structure that one chooses for a
given situation depends largely in the frequency with which specific
operations are performed.
The following four operations play a major role:
Traversing: Accessing each record exactly once so that certain items in
the record may be processed.
Searching: Finding the location of the record with a given key value, or
finding the locations of all such records which satisfy one or more
conditions.
Inserting: Adding a new record to the structure.
Deleting: Removing a record from the structure.
Data Structures Operations
The following two operations, which are used in special situations:
Sorting: Arranging the records in some logical order
Merging: Combining the records in two different sorted files into a single
sorted file.
Time Complexity
Time complexity is a function describing the amount of time an algorithm
takes in terms of the amount of input to the algorithm.
Space Complexity
Space complexity is a function describing the amount of memory
(space) an algorithm takes in terms of the amount of input to the
algorithm.
Time-Space Tradeoff
By increasing the amount of space for storing the data, one may be able to
reduce the time needed for processing the data, or vice versa.
An Example of Time-Space Tradeoff
Suppose a file of records contains names, social security numbers, and
much additional information among its fields. Sorting the file alphabetically
and rising a binary search is a very efficient way to find the record for a given
name. On the other hand, suppose we are given only the social security
number of the person. Then we would have to do a linear search for the
record, which is extremely time-consuming for a very large number of
records. How can we solve such a problem?
An Example of Time-Space Tradeoff
An Example of Time-Space Tradeoff
This is one way of solving the problem that is used frequently, since the
additional space containing only two columns, is minimal for the amount
of extra information it provides.