Data Structure
è Data in computer system
organized in many different ways. The logical and mathematical model of a
particular organization of data is called data structure.
è Choice of a particular
data model depends on two consideration :
- It must be rich enough in structure to mirror the actual
relationship of the data in the real world.
- The structure should be simple enough that one can effectively
process the data when necessary.
è
A data values permanently stored on a file or temporary
stored in a memory which represents a data. Normally , the different data
values are related to each other. These data
values must be organized from and
make use of relationship in programs.
è
To access and process structured data, the programs have to follow certain
rule. Therefore the are represented as:
Data Structure= Organized
Data+Allowed Operation
Data
structure mainly divides into two types:
1. Primitive Data
structure
2. Non- Primitive Data
structure
The hierarchical
representation of data structure is shown in following figure:
Primitive Data Structure :
1. Integer
Integer is numbers with a range of values supported by a
computer. Integer requires 2 bytes in computer memory. A range of integer value
is -32768 to +32767.
In the c language there are 3 classes of integer storage
called short integr, long integer and integer. Short integer can store can
store half value than regular integer. %d is used as a format specifier of
integer.
2. Float
The float data type is used to store floating point
numbers. The range of float is 1.7e-38 to 1.7e+38 float occupies 4 bytes in
memory. %f is used as a format specifier in float. Float data type provides 6 digits
of accuracy.
3. Double
A double data type is also used to store floating point
values, but it provides 14 digits of accuracy. Range of double is 1.7e-308 to
1.7e+308. this data type requires 8 bytes in memory.
%lf is used as a format specifier in double data type.
4. Character
A single character can be
defined as a character data type. Character is used 1 byte for storage %c is
used as a format specifier in character.
Non-Primitive
data structure
The data types which is derived
from the primitive data types is called non primitive data structure. It is
also known as composite types. It is
classified in to two types:
- Linear data structure
Array , Stack ,Queue ,
Linked list, File and Structure.
- Non Linear data structure
Tree, Graph.
Linear
Data structure
1. Array
An array is a collection of
similar data elements that stores in sequential memory locations.
2. Linked
list
A linked list can be defined as
collection of nodes. A node has two fields information and address of the next
node. Nodes are nothing of dynamic structure values connected to each other by
means of pointes.
3. Stack
A stack is a data structure where
information is stored in Last in first out(LIFO) method. All insertion and
deletion s of data can take place at the end of , called TOS Top of the stack.
4. Queue
A queue is the data
structure where information is stored in First in First out (FIFO) method. In
this structure deletion take place at front end , and insertion take place at rear end.
Non –
Linear data structure
1.
Tree
The tree data structure which
reflects the hierarchical relationship between data various data elements. There
are different type of tree called binary tree, Expression tree, Search tree, B-
tree, AVL tree etc. It performs different operations like insertion, deletion,
searching of data with different traversing method.
2.
Graph
This data structure contains
relationship between pairs of elements. It may or may not contain hierarchical
relationship. There are different types of graphs depending on the nature of
the representation of that graph.
Posted By : Ruchita Pandya
No comments:
Post a Comment