Professional Documents
Culture Documents
-STACK , QUEUE
Define Data Structure
• Data Structure is a way of collecting and organising
data in such a way that we can perform operations on
these data in an effective way.
• For example, we have data Student name "Vidhi" and
age 21. Here "Vidhi" is of String data type and 21 is
of integer data type.
• We can organize this data as a record like Student
record
• Collections of students name can be stored as n record
of information.
• Data Structures are structures programmed
to store ordered data, so that various
operations can be performed on it easily.
• It represents the knowledge of data to be
organized in memory.
• It should be designed and implemented in
such a way that it reduces the complexity and
increases the efficiency.
Basic types of Data Structures
• Primitive Data Structures.
-Integer, Float, Boolean, Char
• Abstract Data Structure:
In computer science, an abstract data type (ADT) is
a mathematical model for data types, where a data type is defined
by its behaviour (semantics) from the point of view of a user of the
data, specifically in terms of possible values, possible operations
on data of this type, and the behaviour of these operations. This
contrasts with data structures, which are concrete representations
of data, and are the point of view of an implementer, not a user.
An ADT may be defined as a "class of objects whose logical
behavior is defined by a set of values and a set of operations“.
Example: Stack, Queue,List,Tree, Graph
The data structures can also be classified on
the basis of the following characteristics:
Characterstic Description
Linear In Linear data structures,the data items are arranged
in a linear sequence. Example: Array
Non-Linear In Non-Linear data structures,the data items are not
in sequence. Example: Tree, Graph
Homogeneous In homogeneous data structures,all the elements are
of same type. Example: Array
Non-Homogeneous In Non-Homogeneous data structure, the elements
may or may not be of the same type.
Example: Structures
Implementation 1
Implementation 2
Implementation: Queue using Array
#include<stdio.h>
#include<conio.h>
#define MAX 5