#cpp
- 26 Jan 2024 · Study
C++ · DSA: linked list
A singly linked list built with unique_ptr nodes: push_front, traversal, in-place reversal, and how it compares with vector.
- 23 Jan 2024 · Study
C++ · DSA: sorting
Insertion sort and merge sort written by hand, compared with std::sort and std::stable_sort on the same data.
- 18 Jan 2024 · Study
C++ · DSA: binary search
Binary search by hand with the overflow-safe midpoint, then std::lower_bound, upper_bound and binary_search.
- 15 Jan 2024 · Study
C++ · DSA: stack and queue
LIFO stacks and FIFO queues with std::stack and std::queue, plus two classic uses: bracket matching and BFS.
- 10 Jan 2024 · Study
C++ · Smart pointers
unique_ptr for single ownership, shared_ptr with reference counting, weak_ptr to break cycles, and make_unique/make_shared.
- 5 Jan 2024 · Study
C++ · Memory: new, delete and RAII
Stack vs heap, manual new/delete and why it leaks, and RAII: tying a resource's lifetime to an object's scope.
- 2 Jan 2024 · Study
C++ · STL: algorithms
The <algorithm> and <numeric> toolkit: sort with comparators, find_if, count_if, accumulate, transform, and min/max.
- 27 Dec 2023 · Study
C++ · STL: set
std::set and std::unordered_set for unique elements, insert's return value, and set operations with algorithms.
- 22 Dec 2023 · Study
C++ · STL: map and unordered_map
Ordered std::map (a balanced tree) versus std::unordered_map (a hash table), lookups with find/count, and the operator[] side effect.
- 19 Dec 2023 · Study
C++ · STL: vector
std::vector as C++'s list: push_back, size vs capacity, iterators, erase, and reserving memory.
- 14 Dec 2023 · Study
C++ · Templates
Function and class templates, how the compiler stamps out one version per type, and how this differs from Python's duck typing.
- 11 Dec 2023 · Study
C++ · OOP: inheritance and virtual functions
Public inheritance, virtual functions and runtime polymorphism, override, pure virtual (abstract) classes, and virtual destructors.
- 6 Dec 2023 · Study
C++ · OOP: classes and constructors
Classes with public/private members, constructors with initialiser lists, const member functions, and destructors.
- 1 Dec 2023 · Study
C++ · Functions and overloading
Declaring vs defining functions, default arguments, overloading by parameter types, and lambdas.
- 27 Nov 2023 · Study
C++ · std::string
std::string versus C strings, common operations (substr, find, append, compare), mutability, and converting numbers.
- 22 Nov 2023 · Study
C++ · Arrays
C-style arrays, std::array, 2D arrays, out-of-bounds risk, and why .at() exists.
- 17 Nov 2023 · Study
C++ · References
References as aliases, pass-by-value vs pass-by-reference, and const references for passing big objects cheaply.
- 14 Nov 2023 · Study
C++ · Pointers
What a pointer is, & and * operators, nullptr, pointer arithmetic over an array, and why dangling pointers are dangerous.
- 9 Nov 2023 · Study
C++ · Control flow
if/else, switch, the three kinds of for loop, while and do-while, written next to their Python equivalents.
- 6 Nov 2023 · Study
C++ · Variables, types and I/O
Static types in C++, sizes of the built-in types, integer overflow, auto, const, and reading input with cin.
- 1 Nov 2023 · Study
C++ · Basics: compiling and hello world
Starting C++: the compile-then-run model, main(), #include, and what g++ actually produces.