Data structures in Class 12 Notes

Data structures in Class 12 Notes

1. Data Structure

A data structure is a systematic manner of organizing, storing and managing the data so that it can be accessed and processed efficiently.
Examples are Array, List, Stack, Queue, Linked List, Tree and Graph etc.
Need of Data Structures
1. It is used to store large amounts of data.
2. It is used to organize data efficiently.
3. It is used to perform searching efficiently.
4. It is used to perform insertion and deletion.
5. It is used to sort data.
6. It is used to reduce processing time.
7. It is used to make programs easier to manage.
2. Types of Data Structure
A. Primitive Data Structures
These are basic data types provided by a programming language.
1. Integer (int)
2. Float (float)
3. Character (char, in languages that provide it)
4. Boolean (bool)
B. Non-Primitive Data Structures
These are structures created using or combining basic data types.
1. Array
2. Stack
3. Queue
4. Linked List
5. Tree
6. Graph

3. Linear and Non-linear Data Structures
Linear Data Structure
Elements are arranged sequentially, one after another.
Examples: Array, Stack, Queue and Linked List.

10 → 20 → 30 → 40 → 50
Non-Linear Data Structure
Elements are not arranged in one simple sequence; relationships may be hierarchical or network-based.
Examples: Tree and Graph.

                                             10
/      \
20        30
/    \
40    50

4. Static and Dynamic Data Structures
Static Data Structure
1. It has a fixed capacity or size in the traditional model.
2. Its capacity is decided in advance.
3. Example: a fixed-size array.
Dynamic Data Structure
1. Can grow or shrink during program execution.
2. Memory or capacity can be adjusted as required.
3. Example: Linked List.
5. Array
An array is a collection of elements stored under one name and accessed using an index. In Python, lists are commonly used for array-like operations.
   A = [10, 20, 30, 40, 50]
Index:  0   1    2     3    4
Python list indices start at 0. Therefore, A[0] is 10 and A[4] is 50.
6. Array Traversal
Traversal means visiting each element of an array one by one.
Algorithm
1. Start from the first element.
2. Visit or process the current element.
3. Move to the next element.
4. Continue until the last element has been visited.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!