Dsa Notes
Dsa Notes
• Data structures are methods of organizing and storing data in a computer so that it can be used
efficiently.
• How the data is represented means data structure. Data can be logically and Mathematically
model of a particular organization of data.
• (We are going to store the data into the memory in some order that is called the data structure).
1. Primitive Data Structures:
Definition:
• These are basic data types provided by programming languages. They are typically used for
storing single values.
• The data structures that can be manipulated directly by machine instructions are called
primitive data structures.
• Examples:
– Integer: Whole numbers (e.g., -5, 0, 10).
– Float: Numbers with decimal points (e.g., 3.14, -2.5).
– Character: Single letters, numbers, or symbols (e.g., 'a', '7', '$').
– Boolean: Represents true or false values.
• Pointer: Stores the memory address of another variable.
2. Non-Primitive Data Structures:
Definition:
• These are more complex structures created by combining primitive data types. They are used to
store collections of data and enable more advanced operations.
• The data structures that cannot be manipulated directly by machine instructions are called non-
primitive data
Examples:
1. Array
2. Linked List
3. Stack
4. Queue
5. Tree
6. Graph
7. Hash Table
3. Linear vs. Non-Linear:
Non-primitive data structures can be further classified as linear or non-linear.
• Linear: Elements are arranged in a sequential order, like in an array, linked list, stack, or queue.
• Non-linear: Elements are not arranged in a sequence, like in a tree or graph.