📖 Chapters
- 1. Introduction to DSA and Its Importance
- 2. Time and Space Complexity (Big O, Θ, Ω)
- 3. Recursion and Stack Memory
- 4. Mathematics for DSA (GCD, LCM, Modulo Arithmetic)
- 5. Arrays: Basics and Operations
- 6. Strings: Manipulation & Inbuilt Functions
- 7. Structures and Unions with Arrays
- 8. Linked Lists (Singly, Circular, Doubly)
- 9. Stack (Using Array & Linked List)
- 10. Queue (Simple, Circular, Deque)
- 11. Linear Search & Binary Search
- 12. Sorting Basics: Bubble, Selection, Insertion
- 13. Merge Sort
- 14. Quick Sort
- 15. Counting Sort, Radix Sort, Bucket Sort
- 16. Heap Sort
- 17. Binary Trees & Representations
- 18. Binary Tree Traversals (Pre, In, Post)
- 19. Binary Search Tree (BST)
- 20. AVL Trees (Self-balancing BST)
- 21. Trie (Prefix Tree)
- 22. Segment Tree (Range Queries)
- 23. Fenwick Tree / Binary Indexed Tree (BIT)
- 24. Heap & Priority Queues (Min-Heap, Max-Heap)
- 25. Hashing and Hash Tables
- 26. Disjoint Set Union (Union-Find, Path Compression)
- 27. Sparse Tables
- 28. Sliding Window Technique
- 29. Two Pointers Technique
- 30. Graph Representations (Adjacency Matrix & List)
- 31. BFS and DFS (Traversal & Search)
- 32. Topological Sort (Kahn’s & DFS)
- 33. Shortest Path Algorithms (Dijkstra, Bellman-Ford)
- 34. Minimum Spanning Tree (Kruskal, Prim)
- 35. Cycle Detection in Graphs
- 36. Bridges and Articulation Points
- 37. Greedy Algorithms (Activity Selection, Huffman Coding)
- 38. Backtracking (N-Queens, Sudoku Solver)
- 39. Dynamic Programming (Intro, Memoization, Tabulation)
- 40. Advanced DP (LIS, Knapsack, DP on Trees/Grids)
- 41. Bit Manipulation and XOR Tricks
- 42. Interview Problems from FAANG Companies
- 43. Competitive Coding Patterns
- 44. Building Mini Projects Using DSA (Menu-driven)
- 45. Final Quiz + Problem Sheet (100+ questions)
- 46. Next Steps: Competitive Programming or System Design?
Data Structures and Algorithms in C (DSA)
Category: IT Fundamentals & Programming
This course is designed to help learners master the core concepts of Data Structures and Algorithms (DSA) using the C programming language. Starting from the basics and advancing to complex topics like graphs, dynamic programming, and memory optimization, this course …
Structures and Unions with Arrays
📘 Structures and Unions with Arrays
C language offers composite data types called structures and unions that allow grouping of different types of data under one name. These are especially useful when managing records like student profiles, product data, etc.
🏗️ What is a Structure?
A structure (struct
) is a user-defined data type that groups variables of different data types under one name.
struct Student { int roll; char name[50]; float marks; };
📦 Declaring & Accessing Structure Variables
struct Student s1; strcpy(s1.name, "Amit"); s1.roll = 101; s1.marks = 87.5; printf("Name: %s, Roll: %d, Marks: %.2f", s1.name, s1.roll, s1.marks);
🧑🎓 Array of Structures – Example (UdaanPath)
Suppose you're storing student data for a scholarship test on UdaanPath:
struct Student students[3]; for (int i = 0; i < 3; i++) { printf("Enter name, roll and marks for student %d: ", i+1); scanf("%s %d %f", students[i].name, &students[i].roll, &students[i].marks); }
🔄 Passing Structure to Functions
void printStudent(struct Student s) { printf("Name: %s | Roll: %d | Marks: %.2f\n", s.name, s.roll, s.marks); }
⚖️ Structure vs Union
Feature | Structure | Union |
---|---|---|
Memory | Allocates memory for all members | Shares memory (max size member) |
Access | All members accessible at once | Only one member at a time |
Use Case | Used for grouped data | Memory efficient alternatives |
🔗 Union Example
union Data { int i; float f; char str[20]; }; union Data d; d.i = 10; printf("d.i = %d", d.i);
📚 Practice Tasks
- Create an array of 5 employees with id, name, salary
- Write a function to print student details using structures
- Use union to store different sensor types (int, float, char)
- Compare memory size of structure and union with
sizeof()
✅ Summary
- Structures group different data types in one unit
- Unions share memory and are space efficient
- Both are key for real-world modeling like records, packets, events
📤 Coming Next
In the next chapter, we’ll learn how to pass arrays, structures, and pointers to functions — enabling modular and efficient code structure.