What is Data Structure ?
1.Data may be organized in different ways: the
logical or mathematical model for a particular
organization of data is called the data structure.
OR
2. A data structure is a particular way of organizing
data in a computer so that it can used efficiently.
Algorithm?
Algorithm is a clearly specified set of simple
instructions to be followed to solve a problem.
Once an algorithm is given for a problem and decided
(somehow) to be correct, an important step is to
determine how much in the way of resources, such as
time or space, the algorithm will require.
An algorithm that solves a problem but requires a year
is hardly of any use. Likewise, an algorithm that
requires thousands of gigabytes of main memory is
not (currently) useful on most machines.
Efficiency?
. A solution is said to be efficient if it solves the
problem within its resource constraints. A resource
can be CPU, space or time.
. Cost: The cost of a solution is the amount of
resources that the solution consumes.
Primitive and Non-primitive Data Types?
.The primitive data types are the basic data types
that are available in most of the programming
languages. The primitive data types are used to
represent single values.
.The data types that are derived from primary data
types are known as non-Primitive data types. These
data types are used to store group of values.
Linear and Non-linear Data Structure?
. A data structure is said to be linear if its elements
form a sequence or a linear list. In linear data
structures, the data is arranged in a linear fashion
through the way they are stored in memory may not
be sequential.
. A data structure is said to be non-linear if the data is
not arranged in a sequence. The insertion and
deletion of data is there not possible in a linear
fashion.
Selecting a Data Structure?
Select a data structure as follows:
1. Analyze the problem to determine the resource
constraints a solution must meet. For example, the
available disk space.
2. Determine the basic operations that must be
supported. Quantify the resource constraints for
each operation.
3. Select the data structure that best meets these
requirements.
Data Structure Philosophy?
. Each data structure has costs and benefits.
. Rarely is one data structure better than another in
all situations.
. A data structure requires:
space for each data item it stores,
time to perform each basic operation,
programming effort.
0 Comments