Coding tutorials
Learn a programming language, a design pattern or an algorithm on one page. Each tutorial answers the question first, then shows working code, the common mistakes and the official references.
Programming languages
- 6 min readPythonSyntax, types, control flow, functions, collections, errors and files in one page
- 5 min readJavaScriptVariables, types, functions, arrays, objects, promises and async/await in one page
- 6 min readTypeScriptTypes, interfaces, unions, narrowing, generics and error handling in one page
- 7 min readJavaTypes, classes, records, collections, exceptions and pattern matching in one page
- 7 min readCTypes, functions, arrays, strings, pointers, malloc/free and error handling in one page
- 7 min readC++Types, classes, STL containers, lambdas, RAII, smart pointers and exceptions in one page
- 6 min readC#Types, classes, records, collections, LINQ, async/await and exceptions in one page
- 7 min readGoTypes, slices, maps, structs, interfaces, goroutines, channels and errors in one page
- 7 min readRustOwnership, borrowing, structs, enums, match, collections and Result in one page
- 6 min readPHPVariables, arrays, functions, classes, enums, exceptions and a JSON endpoint in one page
- 6 min readRubyTypes, methods, arrays, hashes, blocks, classes, modules and exceptions in one page
- 7 min readSwiftTypes, optionals, closures, collections, structs, enums, protocols and errors in one page
- 7 min readKotlinNull safety, control flow, functions, data classes and coroutines in one page
- 7 min readDartNull safety, functions, collections, classes and async/await for Flutter
- 7 min readScalaScala 3 syntax, pattern matching, collections, case classes and Option in one page
- 6 min readRVectors, data frames, functions, statistics and plots in R in one page
- 7 min readSQLSELECT, JOIN, GROUP BY, CTEs, transactions and PostgreSQL vs MySQL vs SQLite
- 7 min readBashShell scripts, variables, quoting, loops, functions, pipes and set -euo pipefail
- 7 min readPowerShellCmdlets, the object pipeline, variables, functions, hashtables and try/catch
- 7 min readLuaVariables, tables, functions, metatables and pcall in Lua in one page
- 8 min readPerlScalars, arrays, hashes, subroutines, regular expressions and errors in Perl
- 8 min readHaskellPure functions, types, pattern matching, lists, Maybe and IO in Haskell
- 7 min readElixirPattern matching, pipes, Enum, processes and {:ok, value} error handling
- 7 min readErlangPattern matching, recursion, processes, OTP and let-it-crash error handling
- 6 min readClojureSyntax, immutable collections, functions, macros, atoms and errors in one page
- 6 min readF#Types, records, unions, pattern matching, pipelines and Result in one page
- 6 min readOCamlTypes, records, variants, pattern matching, modules and errors in one page
- 6 min readJuliaTypes, arrays, broadcasting, functions, multiple dispatch and errors in one page
- 7 min readZigTypes, slices, optionals, error unions, comptime, defer and allocators in one page
- 7 min readFortranModern syntax, types, loops, procedures, modules, arrays and iostat in one page
- 7 min readCOBOLDivisions, PIC data, IF/EVALUATE, PERFORM loops, tables, files and errors in one page
- 9 min readAssembly (x86-64)x86-64 NASM registers, instructions, loops, memory, syscalls, calls and AT&T syntax
- 7 min readVisual Basic .NETVB.NET syntax, types, loops, functions, collections, classes, LINQ and VBA in one page
- 6 min readObjective-CMessages, classes, properties, Foundation collections, blocks, ARC and NSError in one page
- 7 min readMATLABMatrices, indexing, loops, functions, structs, cells, errors, plots and Octave in one page
Design patterns
- 7 min readDesign patternsWhat design patterns are, all 23 GoF patterns by category, and how to choose
- 7 min readSOLID principlesThe five SOLID design principles, each with a TypeScript before/after example
- 5 min readSingleton patternEnsure one instance: TypeScript example, async variant, pitfalls and alternatives
- 5 min readFactory Method patternLet subclasses choose which object to create: TypeScript example and when to use it
- 5 min readAbstract Factory patternCreate families of related objects without naming their concrete classes
- 5 min readBuilder patternConstruct complex objects step by step with a fluent API, plus the Director role
- 5 min readPrototype patternCreate objects by cloning instances: TypeScript clone(), deep vs shallow copies
- 5 min readAdapter patternMake incompatible interfaces work together: TypeScript example, object vs class adapter
- 4 min readBridge patternSeparate an abstraction from its implementation so both vary independently
- 5 min readComposite patternTreat single objects and trees of objects the same: TypeScript file-system example
- 5 min readDecorator patternAdd behavior to objects at run time by wrapping them: classes and function decorators
- 5 min readFacade patternGive a complex subsystem one simple entry point: TypeScript checkout example
- 5 min readFlyweight patternShare intrinsic state across many objects to save memory, with a TypeScript example
- 5 min readProxy patternControl access to an object with caching, lazy, protection and remote proxies
- 5 min readChain of Responsibility patternPass a request along handlers until one handles it, plus the middleware form
- 5 min readCommand patternTurn requests into objects to queue, log, undo and redo them in TypeScript
- 5 min readInterpreter patternModel a small language as classes and evaluate expression trees in TypeScript
- 5 min readIterator patternTraverse collections without exposing their storage, with Symbol.iterator and generators
- 5 min readMediator patternCoordinate components through one central object instead of direct references
- 5 min readMemento patternSave and restore an object's state without exposing internals, for undo and checkpoints
- 5 min readObserver patternNotify subscribers automatically when a subject changes, with typed TypeScript code
- 5 min readState patternChange an object's behavior with its state using state classes instead of switch
- 5 min readStrategy patternSwap interchangeable algorithms at runtime, using functions or classes in TypeScript
- 5 min readTemplate Method patternFix an algorithm's steps in a base class and let subclasses fill in the details
- 6 min readVisitor patternAdd operations to a class hierarchy with double dispatch, plus the union-type alternative
Data structures
- 6 min readLinked listSingly and doubly linked lists: insert, delete, reverse, cycle detection and complexity
- 4 min readStack and queueLIFO stacks and FIFO queues in Python: list, deque, bracket matching, BFS and complexity
- 6 min readHash tableHash functions, buckets, collisions, load factor and resizing, with Python code
- 6 min readBinary search treeBST ordering rule, search, insert and delete in Python, balancing and complexity
- 5 min readBinary tree traversalPreorder, inorder, postorder and level order, recursive and iterative Python code
- 6 min readBinary heapHeap property, sift up and down, heapify, priority queues and Python heapq
- 5 min readTriePrefix tree insert, search, starts-with and autocomplete in Python, with complexity
- 5 min readUnion-findDisjoint set union: find, union, path compression, union by rank and size in Python
- 6 min readLRU cacheLeast recently used cache with a hash map and doubly linked list, OrderedDict, lru_cache
Algorithms
- 6 min readBig O notationTime and space complexity, common classes and how to read them from code
- 5 min readRecursionBase cases, the call stack, memoization and recursion limits in Python
- 5 min readBinary searchHow binary search halves a sorted range, Python code, bisect, variants and pitfalls
- 6 min readTwo pointers and sliding windowOpposite-end, fast-slow and sliding window patterns with Python code and traces
- 4 min readBubble sortHow bubble sort swaps neighbours, pass-by-pass trace, Python code and complexity
- 5 min readSelection sortHow selection sort picks the minimum, step-by-step trace, Python code and stability
- 5 min readInsertion sortHow insertion sort shifts items into place, trace, Python code, stability and best cases
- 5 min readMerge sortDivide-and-conquer merge sort: trace, Python code, merge step, stability and complexity
- 6 min readQuicksortPivots, Lomuto partition trace, Python code, worst case, stability and quickselect
- 6 min readHeapsortMax-heaps, sift-down, step-by-step trace, Python code, heapq and complexity
- 5 min readCounting sortLinear-time counting sort for small integer keys: trace, stable Python code, complexity
- 5 min readRadix sortLSD and MSD radix sort: digit-by-digit trace, Python code, stability and complexity
- 5 min readBreadth-first searchBFS with a queue: traced example, Python code, shortest paths and O(V + E) cost
- 5 min readDepth-first searchDFS recursive and iterative in Python, traced example, cycle detection and O(V + E) cost
- 5 min readDijkstra's algorithmShortest paths with a priority queue: traced example, Python heapq code and complexity
- 5 min readBellman-Ford algorithmShortest paths with negative weights, negative cycle detection and Python code
- 6 min readFloyd-Warshall algorithmAll-pairs shortest paths: traced matrix example, Python code, path rebuilding and O(V³)
- 6 min readA* searchHeuristic pathfinding with f = g + h: admissible heuristics, grid example, Python code
- 5 min readTopological sortOrder tasks by dependencies: Kahn's algorithm, DFS, graphlib and cycle detection
- 5 min readMinimum spanning treeKruskal's and Prim's algorithms: traced example, Python code, union-find and heaps
- 6 min readDynamic programmingMemoization vs tabulation, coin change and LCS traced, Python code and complexity
- 5 min readGreedy algorithmsBest local choice at each step: interval scheduling traced, Python code, counterexamples
- 6 min readBacktrackingChoose, explore, unchoose: N-Queens traced, subsets, permutations and pruning in Python
- 5 min readKMP string searchKnuth-Morris-Pratt: prefix function, traced search, Python code and O(n + m) cost
- 6 min readBit manipulationBitwise operators, single-bit tricks, bit counting and bitmasks with Python examples
Language tutorials take you from installing the tools and printing Hello, world to functions, collections, error handling and a small complete program. Pattern pages explain the problem each Gang of Four pattern solves, with a TypeScript example and when not to use it. Data structure and algorithm pages trace an example step by step, give Python code and state the time and space complexity.
Code samples are short and runnable as shown, and every page links to the language documentation, standard or original source it was checked against.
FAQ
Which programming language should I learn first?
For most beginners Python or JavaScript: both have simple syntax, huge communities and run everywhere. Pick JavaScript for websites, Python for data, automation and general programming.
Do I need to install anything to follow the tutorials?
Each language tutorial starts with how to install the official tools and run your first program. Pattern and algorithm pages use TypeScript and Python, which you can run locally or in any online playground.
Are these tutorials free?
Yes. Every tutorial is free to read with no account, and the code samples may be reused in your own projects.
What is the difference between data structures and algorithms?
A data structure is a way to store data, such as an array, hash table or tree. An algorithm is a sequence of steps that solves a problem, such as sorting or finding a shortest path, and its speed often depends on the data structure it uses.