Introduction to DS
Introduction to DS
Definition Raw, unprocessed facts and figures without context Processed, organized data that is meaningful and useful
Dependence Exists independently as raw material Created through processing of data; dependent on data
Accuracy May contain errors, redundancies, or irrelevant entries Typically filtered, cleaned, and verified for accuracy
• Storage representation of user data: User data should be stored in such a way that
the computer can understand it.
• We know that for the integer data type (int) in the C programming language, the
structure includes the following types:
• 𝒟 = {0, ±1, ±2, ±3, ...}
• 𝒻 = {+, -, *, /, %}
• It can be easily recognized that the triplet ( 𝒟, 𝒻, 𝒜) is nothing but an abstract data
type. Also, the elements in set 𝒟 are not necessarily from primitive data; it may
• Now the set 𝒟 of Complex. Let us specify the set of operations for the Complex data type, which are stated as:
𝒻 = { ⊕, ⊖, ⊗, ⊘, ∇, ‖ }
• Some data structures are used more frequently than others due to their flexibility and
efficiency in handling various operations.
• These commonly used structures are known as fundamental or classic data
structures.
• Data structures can be classified into two broad categories:
• Linear Data Structure: A data structure in which data elements are arranged
sequentially or linearly. Examples are array, stack, queue, etc.
• Non-linear Data Structure: Data structures where data elements are not placed
sequentially or linearly. Examples are trees and graphs.
Linear Data Structure
Arrays:
Fixed-size collections of elements stored in
contiguous memory locations.
Queue: Follows First-In-First-Out (FIFO)
principle, where the first element added is the
first removed.
Stack: Follows Last-In-First-Out (LIFO)
principle, where the last element added is the first
removed.
Linked List: A series of connected nodes, where
each node contains data and a link to the next
node.
Non Linear Data Structure
Trees:
•Hierarchical structures with nodes connected by edges.
Graphs:
•Collections of nodes (vertices) and edges, which may
be directed or undirected.
Tables:
•Data structure used to store key-value pairs, often
implemented as hash tables.
Sets:
•Unordered collections of unique elements.
Implementation of Data Structures
The classic data structures as mentioned in two phases:
Phase 1: Storage representation: Here we will decide how a data structure can be
• The details of the operation can be understood easily and the reader can
• For example, there are some basic constructs in the C language are