Master programming languages from Python to Rust. Learn core concepts like variables, OOP, functional programming, algorithms, data structures, and competitive programming techniques.
Complete guide to programming languages and computer science fundamentals from absolute beginner to expert level.
Beginner → Intermediate → Advanced → Expert
↓ ↓ ↓ ↓
Syntax Paradigms Patterns Optimization
Pick a Language:
Learn Fundamentals:
Understand OOP/FP:
Master Algorithms & DS:
Practice & Specialize:
# Variables and types
name = "Alice" # Dynamic typing
age = 30
# Functions
def greet(name):
return f"Hello, {name}!"
# List comprehension
squares = [x**2 for x in range(10)]
# OOP
class Person:
def __init__(self, name):
self.name = name
// Variables (let, const)
const name = "Alice";
let count = 0;
// Functions (arrow functions)
const greet = (name) => `Hello, ${name}!`;
// Objects and arrays
const user = { name: "Alice", age: 30 };
const numbers = [1, 2, 3, 4, 5];
// Async/await
async function fetchData() {
const data = await fetch('/api/data');
return data.json();
}
package main
import "fmt"
// Simple syntax
func greet(name string) string {
return fmt.Sprintf("Hello, %s!", name)
}
// Goroutines for concurrency
go func() {
fmt.Println("Running concurrently")
}()
// Interfaces (duck typing)
type Reader interface {
Read(p []byte) (n int, err error)
}
public class Person {
private String name;
private int age;
public Person(String name, int age) {
this.name = name;
this.age = age;
}
// Streams API
List<Person> adults = people.stream()
.filter(p -> p.getAge() >= 18)
.collect(Collectors.toList());
}
// Type annotations
interface User {
name: string;
age: number;
}
// Generic functions
function getValue<T>(arr: T[], index: number): T {
return arr[index];
}
// Union types
type Response = Success | Error;
// Ownership system (unique selling point)
let s1 = String::from("hello");
let s2 = s1; // s1 is moved, can't use it anymore
// Borrowing
let s3 = &s1; // Immutable borrow
let s4 = &mut s1; // Mutable borrow
// Pattern matching
match value {
Some(x) => println!("Value: {}", x),
None => println!("No value"),
}
Essential DS Cheat Sheet:
| Structure | Insert | Search | Delete | Use Case |
|---|---|---|---|---|
| Array | O(n) | O(n) | O(n) | Random access |
| Linked List | O(1) | O(n) | O(1) | Sequential access |
| Hash Table | O(1)* | O(1)* | O(1)* | Key-value storage |
| Binary Tree | O(log n)* | O(log n)* | O(log n)* | Hierarchical data |
| Graph | - | O(V+E) | - | Networks, relationships |
*Average case, depends on implementation
1. Sorting Algorithms
Quick Sort: O(n log n) average, in-place, most common
Merge Sort: O(n log n) guaranteed, stable, parallel-friendly
Heap Sort: O(n log n), in-place
Bubble Sort: O(n²) - avoid, only for learning
2. Searching
Binary Search: O(log n) on sorted arrays
Linear Search: O(n) on unsorted
Hash Lookup: O(1) average
3. Dynamic Programming
Common patterns:
- Fibonacci (overlapping subproblems)
- Longest Common Subsequence (optimal substructure)
- Knapsack Problem (decision trees)
O(1) → Constant (best)
O(log n) → Logarithmic
O(n) → Linear
O(n log n)→ Linearithmic
O(n²) → Quadratic
O(n³) → Cubic
O(2ⁿ) → Exponential
O(n!) → Factorial (worst)
Space Complexity: Same analysis applies to memory usage
The dominant paradigm. Four pillars:
1. Encapsulation - Hide internal state, expose interface
2. Inheritance - Reuse code through class hierarchies
3. Polymorphism - Same interface, different implementations
4. Abstraction - Deal with essential features only
Example in Python:
# Encapsulation + Abstraction
class Animal:
def __init__(self, name):
self.__name = name # Private
# Polymorphism - override in subclasses
def speak(self):
pass
# Inheritance
class Dog(Animal):
def speak(self):
return f"{self.__name} says Woof!"
Alternative paradigm gaining popularity.
Core concepts:
- Pure functions - No side effects
- Immutability - Don't modify data
- First-class functions - Functions as values
- Higher-order functions - Functions that operate on functions
Example in JavaScript:
// Pure function
const add = (a, b) => a + b;
// Higher-order function
const map = (fn, arr) => arr.map(fn);
// Immutability
const newList = [...oldList, newItem];
Target these in order of importance:
Arrays & Hashing (25% of interviews)
Two Pointers (15%)
Sliding Window (15%)
Stack (10%)
Binary Search (10%)
Linked List (10%)
Trees & Graphs (10%)
Greedy & DP (5%)
Week 1-2: Arrays, Hashing, Two Pointers (Master basics)
Week 3-4: Strings, Sliding Window (Pattern recognition)
Week 5-6: Linked Lists, Stack (Data structure manipulation)
Week 7-8: Trees, Graphs (Traversals and patterns)
Week 9-10: Dynamic Programming (Complex problems)
Week 11-12: Mock interviews (Practice under pressure)
For algorithm competitions and contests:
Source: https://roadmap.sh/python, https://roadmap.sh/javascript, https://roadmap.sh/java, and more