Introduction to Data Structure
Definition: The data structure can be defined as the collection of
elements and all the possible operations which are required for those set
of elements.
Data Structures = Organization of data + Allowed Operations
Types of Data Structures
The data structures can be divided into two basic types Primitive data
structure and Non-primitive data structure. The Fig. shows various types
of data structures.
Primitive Data Structures:
These are the basic building blocks provided by programming
languages. They store single values. Examples include:
● Integers: Whole numbers.
● Floats: Decimal numbers.
● Characters: Single letters or symbols.
● Booleans: True/false values.
2. Non-Primitive Data Structures:
These are more complex structures built using primitive data structures
or other non-primitive structures. They can be further categorized:
● Linear Data Structures:
Elements are arranged sequentially, with each element connected to the next.
o Arrays: A collection of elements of the same data type stored at
contiguous memory locations.
o Linked Lists: A sequence of elements (nodes) where each node contains
data and a reference to the next node.
o Stacks: Follows the Last-In, First-Out (LIFO) principle; elements are added
and removed from one end (the top).
o Queues: Follows the First-In, First-Out (FIFO) principle; elements are added
at the rear and removed from the front.
● Non-Linear Data Structures:
Elements are not arranged sequentially and can connect to multiple other elements.
o Trees: Hierarchical structures where data is organized in a parent-child
relationship. Examples include Binary Trees, Binary Search Trees, and
AVL Trees.
o Graphs: A collection of nodes (vertices) connected by edges, representing
relationships between data elements.