🔧 System Design Basics
System Design is how you architect complex systems like apps,
websites, or services to handle scale, reliability, and performance.
🔹 Key Components:
1. Load Balancer – Distributes traffic across multiple servers to avoid
overload.
2. Database – Stores persistent data (SQL for structured, NoSQL for
flexibility).
3. Cache – Stores frequently used data (e.g., Redis, Memcached) to
reduce DB load.
4. Message Queue – (e.g., Kafka, RabbitMQ) used for asynchronous
communication between services.
5. API Gateway – A single entry point for APIs (e.g., authentication,
rate limiting).
🔹 Design Principles:
Scalability: Can the system handle more users/data? (Horizontal
scaling = adding machines)
Availability: Is the system always up and running?
Latency: How fast is the system's response?
Consistency: Are all parts of the system up-to-date with the same
data?
🔹 Common Questions:
Design Instagram
Design a URL shortener like [Link]
Design YouTube comment system
🌐 Computer Networks
Understanding how devices communicate over the internet is core CS
knowledge.
🔹 OSI Model (7 Layers):
1. Physical – Hardware (cables, switches)
2. Data Link – MAC address, switches
3. Network – IP address, routers
4. Transport – TCP/UDP
5. Session – Connections (authentication)
6. Presentation – Data format (encryption, compression)
7. Application – User interface (HTTP, FTP, DNS)
🔹 Protocols:
TCP – Reliable connection (used in email, web)
UDP – Faster, no guarantee (used in video streaming, gaming)
HTTP/HTTPS – Used by websites
DNS – Converts domain names to IP addresses
💾 Data Structures in Depth
🔹 Trees:
Binary Tree: Each node has 2 children max
Binary Search Tree (BST): Left < Node < Right
AVL Tree: Self-balancing BST
Trie: Used for word search/autocomplete
🔹 Graphs:
Represent networks (social media, maps)
Can be directed/undirected, weighted/unweighted
Traversal algorithms: BFS, DFS
Applications: Shortest path (Dijkstra), Cycle detection, Topological
sort