// cs-concepts-cheatsheet.html

Computer Science
Fundamentals

A visual reference guide to some core CS concepts — written in plain language for students learning how computers actually work.

Concepts: 06
Built with: HTML & CSS
By: Harshwardhan Kumar Paswan
01 / 06
How RAM Works
Memory

RAM (Random Access Memory) is your computer's short-term memory. It temporarily stores data that the CPU is actively using — like an open browser tab, a running program, or a document you're editing.

Unlike your hard drive, RAM is volatile — it loses everything the moment you turn off your computer. But it's also extremely fast, which is why the CPU uses it instead of reading from the hard drive every time.

// RAM memory cells — active cells highlighted
0x01
0x02
0x03
0x04
0x05
0x06
0x07
0x08
0x09
0x0A
0x0B
0x0C
0x0D
0x0E
0x0F
0x10

In use    Currently active    Free

Why more RAM = faster computer

If your RAM fills up, the OS starts using a portion of your hard drive as "virtual memory" — which is 100x slower. More RAM means more programs can run simultaneously without this slowdown.

Real world analogy: RAM is your desk. Your hard drive is the filing cabinet across the room. You work on what's on your desk — fast. When the desk is full, you have to keep walking to the cabinet — slow.

02 / 06
What is an Algorithm
Logic

An algorithm is a precise, step-by-step set of instructions for solving a problem. It takes an input, processes it, and produces an output — every time, predictably.

Algorithms are not code. They are the idea behind the code. You can write the same algorithm in Python, Java, or any language — the logic stays the same.

A simple example — making tea

// Algorithm: Make a cup of tea 1. Boil water 2. Place teabag in cup 3. Pour boiling water into cup 4. Wait 3 minutes 5. Remove teabag 6. if (want_milk) → add milk 7. if (want_sugar) → add sugar 8. Serve

What makes a good algorithm?

Three things: it must be correct (gives the right answer), efficient (doesn't waste time or memory), and clear (someone else can follow it).

Key insight: The entire field of Computer Science is essentially the study of algorithms — how to design them, analyse them, and improve them.

03 / 06
Data Types
Programming

A data type tells the computer what kind of value a variable holds — and therefore how much memory to allocate and what operations are allowed on it.

Every piece of data in a program has a type. Even if you don't declare it explicitly (like in Python), the computer still tracks it internally.

int
age = 21
Whole numbers. No decimal point. Used for counting.
float
price = 9.99
Numbers with a decimal point. Used for measurements.
str
name = "Harsh"
Text — any sequence of characters in quotes.
bool
is_member = True
Only two values: True or False. Used in conditions.
list
marks = [88, 92, 79]
An ordered collection of values. Can be changed.
dict
{"name": "Harsh"}
Key-value pairs. Like a real dictionary — look up by key.

Why it matters: Using the wrong data type wastes memory and causes bugs. Storing a phone number as an int instead of a str would strip leading zeros — a classic beginner mistake.

04 / 06
What is the Internet
Networks

The Internet is a global network of computers connected to each other, communicating through a shared set of rules called protocols. The most important of these is TCP/IP.

When you open a website, your browser sends a request across this network to a server somewhere in the world, which sends back the page data — all in milliseconds.

What happens when you type a URL

// Request journey
Your browser
DNS lookup
IP address found
Request sent
Server responds
Page renders

Internet vs World Wide Web

These are not the same thing. The Internet is the physical infrastructure — cables, routers, servers. The Web is just one service that runs on top of it, using HTTP. Email, FTP, and SSH are other services that also run on the Internet but are not the Web.

Key fact: Every device on the Internet has an IP address — a unique numerical label like 192.168.1.1 — that identifies it on the network, just like a postal address identifies a house.

05 / 06
How a Compiler Works
Systems

A compiler translates human-readable source code (like C or Java) into machine code — the binary instructions a CPU can directly execute. Without a compiler, your code is just text.

Python uses an interpreter instead — which translates and runs code line by line rather than all at once. This is why Python is slower than compiled languages but easier to work with.

The compilation process

// Stages of compilation
01
Lexical Analysis
Breaks source code into tokens (keywords, symbols, names)
02
Syntax Analysis
Checks if tokens follow the grammar rules of the language
03
Semantic Analysis
Verifies meaning — e.g. are variables declared before use?
04
Optimisation
Rewrites code to run faster without changing what it does
05
Code Generation
Produces the final machine code the CPU can execute

Compiler vs Interpreter: A compiler translates the whole program at once before running it. An interpreter translates and runs it one line at a time. Compiled = faster at runtime. Interpreted = easier to debug and test.

06 / 06
Boolean Logic
Logic Gates

Boolean logic is the foundation of all computing. Every decision a computer makes — every if/else, every condition — ultimately reduces to boolean values: True (1) or False (0).

Named after mathematician George Boole, it uses three fundamental operations: AND, OR, and NOT. All other logic can be built from these three.

Truth tables

// AND, OR, NOT operations
AB A AND B A OR B NOT A
FalseFalse False False True
FalseTrue False True True
TrueFalse False True False
TrueTrue True True False

In Python

is_member = True age = 21 # AND — both must be true if is_member and age >= 18: print("Access granted") # OR — at least one must be true if is_member or age >= 21: print("Welcome") # NOT — flips the value if not is_member: print("Please sign up")

Why it matters: Every logic gate in a CPU is built from boolean operations. Billions of AND, OR, NOT operations happen every second inside your computer — all reducible to 1s and 0s.