UNIT 00No prerequisites45 min read
Before we write a single line of code, we need to answer four honest questions. What is DSA? Why do companies test it? How does a computer actually store your data? And why are we using C instead of Python or JavaScript?
This unit is for everyone — especially those who have never written code before, or who come from a non-IT background. If you already know some programming, you will still find the memory and computer internals section useful. Read it anyway.
// Section 1
What is Data Structures & Algorithms?
Let's start with the two words separately — because most explanations combine them too early and create confusion.
📦 Data Structure = How you organise your data
Imagine you are moving to a new house. You have 200 items — clothes, books, utensils, documents. Now you have two choices:
❌ Bad approach
Throw everything into one giant room randomly. When you need your passport, you dig through 200 items. Every time.
✅ Good approach
Label boxes. Documents in one box, clothes by type in another, kitchen items together. Finding your passport takes 5 seconds.
A data structure is that labelled box system — but for data inside a computer. It is a way of organising information so you can find it, change it, and use it efficiently.
📋 Algorithm = Step-by-step instructions to solve a problem
You already use algorithms every day without knowing it. When you make tea:
Step 1: Boil water
Step 2: Add tea leaves
Step 3: Wait 3 minutes
Step 4: Add milk and sugar
Step 5: Pour and serve
That is an algorithm. A fixed set of steps that, if followed correctly, always produces the right result. In programming, an algorithm is the same thing — a clear sequence of steps to solve a specific problem, written in code.
💡 Note
Put together: Data Structures decide how your data is stored. Algorithms decide how you work on that data. They always go together — the right data structure makes an algorithm fast; the wrong one makes it impossibly slow.
// Section 2
Why Does Every Tech Company Test DSA?
If you have ever looked at a software job description, you have seen this: "Data Structures and Algorithms round." You may have wondered — why? I just want to build websites. Why do I need to know how to reverse a linked list?
Here is the honest answer.
01
They cannot test your real work in 45 minutes
In a real job, you build things over days and weeks with teammates, documentation, and Google. Companies cannot replicate that in an interview. So they use DSA as a proxy — a controlled test of how your brain approaches problems.
02
Efficiency matters at scale
When Swiggy processes 10 million orders a day, a slow algorithm is not just inconvenient — it causes system crashes and financial loss. Engineers who understand complexity know how to write code that holds up under real load.
03
It separates problem-solvers from copy-pasters
Anyone can copy code from Stack Overflow. DSA tests whether you understand what the code is doing and why. That understanding is what makes someone a real engineer.
04
It is a universal language
Python, Java, JavaScript, C++ — languages come and go. But a binary search tree works the same way in all of them. DSA knowledge transfers across every language, framework, and company you will ever work at.
🎯 Pro Tip
Real talk: Even if you never work at Google or Flipkart, DSA makes you a better programmer. You will write faster code, catch bugs earlier, and understand why systems behave the way they do. It is worth learning regardless of your goal.
// Section 3
How Your Computer Actually Stores Data
This section is something most tutorials completely skip. They just say "create a variable" and move on. We are not going to do that — because if you do not understand what happens in memory, a huge part of DSA will always feel like magic tricks instead of logic.
Think of RAM as a street full of houses
Your computer's RAM (Random Access Memory) is where all active data lives while a program is running. Think of it as a very long street with millions of tiny houses. Each house has a unique address and can hold exactly one small piece of information.
// RAM — a row of memory cells, each with an address
Each box = one memory cell. Each address = its location. Data sits inside.
When you write int age = 25 in a program, your computer does three things:
1
Finds a free memory cell somewhere in RAM
2
Puts the value 25 into that cell
3
Remembers the address of that cell under the name "age"
📌 Real World Example
Analogy: Your name is "Rahul." That is your label. Your Aadhaar number is your actual address in the government system. The government does not think of you as "Rahul" — it thinks of you as a 12-digit number. Variables work the same way. The name is for you. The address is for the computer.
// Section 4
Why Are We Using C?
You might be wondering — everyone online uses Python or Java for DSA. Why are we doing this in C? Good question. Here is the full honest answer.
🔍
C hides nothing
In Python, you write mylist.append(5) and data magically goes in. In C, you manage the memory yourself. You see exactly what is happening — which means you truly understand it.
🧠
Forces real understanding
Pointers, memory allocation, struct — C forces you to think about how a linked list actually works in RAM. Python hides all this. C reveals it. Once you understand it here, Python becomes trivial.
🏎️
Closest to how machines work
C is one step above assembly language. Understanding C means understanding computers. Every language you ever learn after C will make more sense because of this foundation.
🎓
University standard
Almost every CS curriculum worldwide teaches DSA in C or C++. Textbooks, university notes, competitive programming — C is the default. Learning it here means nothing will ever be unfamiliar.
🎯 Pro Tip
You do not need to know C before starting. We teach you exactly the C you need, right before you need it. You will not be reading a C textbook. You will be learning just enough C to implement each data structure — nothing more.
// Section 5
Your First C Program — Line by Line
Let us write actual code. This is the most classic program in all of programming — printing "Hello, World!" on the screen. We are going to explain every single line so nothing is a mystery.
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
#include <stdio.h>
Import the tools you need
Think of this as saying "I need the printing tools." stdio.h is a file that contains the definition of printf. Without this line, C would not know what printf means. The # means it is a preprocessor command — it runs before your actual code compiles.
int main() {
The entry point of your program
Every C program must have a main function. When you run a C program, the computer looks for main and starts executing from there. The int before it means this function will return a whole number when it finishes. The { means start of the block.
printf("Hello, World!\n");
Print something to the screen
printf stands for "print formatted." It takes whatever is inside the quotes and shows it on screen. The \n is a newline character — it moves the cursor to the next line. The semicolon ; at the end is mandatory in C — it marks the end of a statement.
return 0;
Tell the system everything went fine
The main function promised to return an int. Returning 0 is a convention meaning "program ended successfully." If something went wrong, you would return 1 or another non-zero number.
}
End of the main function
Every opening curly brace { must have a matching closing brace }. This one closes the main function block.
Now let us work with variables
A variable is a named box in memory that holds a value. In C, you must always say what type of value the box will hold. This is called a data type.
| Type | What it stores | Example | Memory size |
|---|
| int | Whole numbers | 5, -3, 1000 | 4 bytes |
| float | Decimal numbers | 3.14, -0.5 | 4 bytes |
| char | A single character | 'A', 'z', '9' | 1 byte |
| double | High-precision decimal | 3.14159265 | 8 bytes |
#include <stdio.h>
int main() {
int age = 20; /* whole number */
float height = 5.9; /* decimal number */
char grade = 'A'; /* single character — use single quotes */
printf("Age: %d\n", age); /* %d for integers */
printf("Height: %f\n", height); /* %f for floats */
printf("Grade: %c\n", grade); /* %c for characters */
return 0;
}
The %d, %f, and %c are format specifiers — placeholders that tell printf what type of value to print. The actual variable comes after the comma.
Taking input from the user
#include <stdio.h>
int main() {
int number;
printf("Enter a number: ");
scanf("%d", &number); /* read an integer from the user */
printf("You entered: %d\n", number);
return 0;
}
Notice the &number — that ampersand (&) means "the memory address of number." scanf needs to know where to store the value you type, so you give it the address.
☁️ Azure
Preview of Unit 04: That & symbol you just saw is the beginning of pointers. You gave scanf the address of a variable so it could write directly into memory. That exact idea — working with addresses — is how linked lists, trees, and graphs are built. You have already touched the most important concept in C.
Decisions and loops — the last basics you need
#include <stdio.h>
int main() {
int marks;
printf("Enter your marks: ");
scanf("%d", &marks);
/* Decision — if/else */
if (marks >= 60) {
printf("Result: Pass\n");
} else {
printf("Result: Fail\n");
}
/* Repetition — for loop: print 1 to 5 */
int i;
for (i = 1; i <= 5; i++) { /* i++ means add 1 to i each time */
printf("%d ", i);
}
printf("\n");
return 0;
}
i = 1→ Start — i begins at 1
i <= 5→ Condition — keep going while i is 5 or less
i++→ Update — add 1 to i after each loop (i++ is shorthand for i = i + 1)
// What's Next
You Are Ready for Unit 01
You now know what DSA is, why it matters, how memory works, why we use C, and the basics of writing C programs. That is the complete foundation.
In Unit 01, we tackle Complexity — how to measure the speed and memory usage of any piece of code. This is the skill that separates engineers who write code from engineers who write good code.
UP NEXT → UNIT 01
Complexity — The Scoreboard for Code
Big O, time complexity, space complexity — in plain English.
Coming Soon →🎯 Key Takeaways
- ✓DSA = Data Structures (how data is organised) + Algorithms (step-by-step instructions to solve problems)
- ✓Companies test DSA because it reveals how you think — not just what frameworks you know
- ✓Every variable lives at a specific address in RAM. The variable name is just a human label
- ✓We use C because it hides nothing — you see exactly what happens in memory
- ✓#include <stdio.h> imports print tools. int main() is the entry point. printf prints. return 0 means success
- ✓int, float, char, double are the four basic data types. Use %d, %f, %c to print them
- ✓The & in scanf gives the memory address of a variable — your first glimpse of pointers