DATA
STRUCTURES
IN
C PROGRAMMING
Introduction to Data Structures in C
A data structure is a way of organizing and storing data to perform operations efficiently. In C programming, data structures help
manage and manipulate data efficiently, improving performance and memory usage.
Types of Data Structures in C:
Linear Data Structures (Elements are arranged sequentially)
--> Arrays – Fixed-size collection of elements.
--> Linked Lists – Dynamic memory allocation with pointers.
--> Stacks – LIFO (Last In, First Out) structure.
--> Queues – FIFO (First In, First Out) structure.
Non-Linear Data Structures (Elements have complex relationships)
--> Trees – Hierarchical structure (e.g., Binary Trees).
--> Graphs – Nodes connected by edges (e.g., social networks).
--> Hash Tables (Maps) – Key-value pairs for fast lookups.
Why learn Data Structures ?
• Improves problem-solving and coding skills.
• Essential for competitive programming and technical interviews.
Why Are Data Structures
Important ?
• Efficient Data Access – Faster searching and sorting.
• Optimized Memory Usage – Prevents wastage of memory.
• Scalability – Handles large amounts of data effectively.
• Real-World Applications – Used in databases, file systems, AI, etc.
CONTEN
TS
01 ARRAYS 02 BINARY TREE
ARRAY
Array is a collection of elements of the same type stored in contiguous memory
locations. Each element is accessed using an index. Arrays come under Linear type of
data structure.
Example:
Syntax in C:
int arr[5] = {1, 2, 3, 4, 5};
data_type array_name[size];
EXAMPLE OF ARRAY
Advantages & Disadvantages
✅ Advantages
• Fast Access: O(1) time for index-based access.
• Memory Efficiency: Uses contiguous memory locations.
• Simple Implementation: Easy to declare and use.
❌ Disadvantages
• Fixed Size: Size is static in C (unless using dynamic
allocation).
• Insertion/Deletion Costly: Shifting elements takes O(n)
time.
Applications of Arrays in DSA
✅ Used in sorting algorithms (Bubble Sort, Quick Sort, Merge Sort).
✅ Used in searching algorithms (Linear Search, Binary Search).
✅ Used in stacks, queues, graphs, and dynamic programming.
BINARY TREE
A Binary Tree is a hierarchical data structure where each node has at most two children. It
is widely used in searching, sorting, and hierarchical data representation. These come
under
NON-LINEAR data structures.
EXAMPLE
Your paragraph text
📌 Expected Output
Preorder Traversal: 1 2 4
53
📌 THE TREE STRUCTURE:
📌 Applications of Binary Trees
✅ Hierarchical Data Representation (Organization Structure, File System).
✅ Binary Search Trees (BSTs) → Fast Searching (O(log N)).
✅ Huffman Encoding (Data Compression).
✅ Expression Trees in Compilers.
✅ AI and Decision Trees.
THANK
YOU
BY
AKSHATA KHATAL B14