4.data Structure
4.data Structure
Structures
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.
Data structure is formerly defined to be a triplet (D,F,A)
Where,
F=(+,-,*,/,%)
The primitive data structures are the basic data types that are
available in most of the programming languages.
The primitive data structures are used to represent single
values.
Example:
Integer, character, string, Boolean
NON-PRIMITIVE DATASTRUCTURE
The data structure that are derived from primary data
structure is known as non-Primitive data structure.
These data types are used to store group of values.
Example:
Arrays, Structure, Union, linked list, Stacks, Queue etc.
LINEAR DATA STRUCTURES:
In linear data structure the elements are stored in sequential order.
The linear data structures are
Array: Array is a collection of data of same data type stored in
consecutive memory location and is referred by common name
Linked list: Linked list is a collection of data of same data type but
the data items need not be stored in consecutive memory locations.
Stack: A stack is a Last-In-First-Out linear data structure in which
insertion and deletion takes place at only one end called the top of the
stack.
Queue: A Queue is a First in First-Out Linear data structure in which
insertions takes place one end called the rear and the deletions takes
place at one end called the Front.
NON-LINEAR DATA STRUCTURE:
Elements are stored based on the hierarchical relationship
among the data. The following are some of the Non-Linear data
structure
Trees:
• Trees are used to represent data that has some
hierarchical relationship among the data elements.
Graph:
• Graph is used to represent data that has relationship
between pair of elements not necessarily hierarchical in
nature. For example electrical and communication
networks, airline routes, flow chart, graphs for planning
projects.
Operation on data structure.
Insertion: Adding new element in the data structure
Deletion: It is removing data from data structure
Searching: It is finding location of a data in within a
given data structure.
Sorting: It is arranging of data in some logical order.
Traversing: A data structure is accessing each data only
once.
Merging: It is combining of two similar data structures.