๐Ÿš€ DSA with C – Day 1: Introduction & Setup

 

๐Ÿš€ DSA with C – Day 1: Introduction & Setup

๐ŸŽฏ Goal:

  • Understand what DSA is.

  • Set up your C environment.

  • Write your first C program.

  • Learn about time & space complexity (theory).

  • Practice basic input/output and loops.


๐Ÿง  Theory: What is DSA?

  • Data Structures = Ways to organize and store data efficiently.

  • Algorithms = Step-by-step instructions to solve problems.

  • Why DSA matters: Faster apps, better problem-solving, cracking tech interviews.


๐Ÿ”ง Setup for C Programming

  • Install a C compiler:

    • Windows: Use Code::Blocks or install MinGW and use VS Code.

    • Mac/Linux: Already comes with gcc. Use VS Code or terminal.

  • Create your first .c file.


๐Ÿ‘จ‍๐Ÿ’ป Hello World Program


#include <stdio.h> int main() { printf("Hello, World!\n"); return 0; }

Compile using:


gcc hello.c -o hello ./hello

๐Ÿ“š Time & Space Complexity (Intro)

  • Big O Notation (O(n), O(1), etc.)

  • Example:

    • Loop runs n times → O(n)

    • Constant statement → O(1)

Watch a quick 10 min video or read short notes on Big O notation.


๐Ÿงช Practice: Basic C I/O and Loops

Tasks:

  1. Take input of two numbers and print their sum.

  2. Print numbers from 1 to n using a for loop.

  3. Write a program to find if a number is even or odd.

Example:


#include <stdio.h> int main() { int a, b; printf("Enter two numbers: "); scanf("%d %d", &a, &b); printf("Sum = %d\n", a + b); return 0; }

๐Ÿ“… Day 1 Summary

  • ✅ Installed C

  • ✅ Understood what DSA is

  • ✅ Learned about time/space complexity

  • ✅ Practiced basic C programs


๐Ÿ“˜ Homework for Day 1:

  • Write a program to find the factorial of a number.

  • Write a program to print a multiplication table.


๐ŸŒŸ Tomorrow: Arrays in C + Linear Search

Comments

Popular posts from this blog

Raster scan Vs Vector Scan

Inheritance

unit -1 Introduction of Image processing