What Is a Symbol Table in C++ and How Is It Implemented?
A symbol table maps identifiers to type and scope in a compiler. This guide builds a scoped symbol table in modern C++20.
Spread Your Knowledge. Questions with answers, tutorials and articles, newest first.
A symbol table maps identifiers to type and scope in a compiler. This guide builds a scoped symbol table in modern C++20.
std::set holds unique sorted keys; std::map adds a value to each key. See examples, complexity, the operator[] trap and when to use unordered or flat containers.
Learn what std::map is, how it works as a balanced tree, and how to insert, look up and iterate safely, with a comparison to unordered_map.
A C++ set stores unique elements with fast lookup. Compare std::set, std::unordered_set and C++23 std::flat_set, with custom types and set algorithms.
std::priority_queue is a heap-backed container adapter that returns the largest element first. See min-heaps, custom comparators and how to build one yourself.
A graph models vertices and edges. This guide builds a C++20 Graph class with an adjacency list and implements BFS, DFS and Dijkstra's shortest paths.
Compare hash tables and binary search trees in C++ using std::unordered_map, std::map and a unique_ptr based BST, and learn when each one is the right choice.
A hash table gives average constant-time lookup. Learn std::unordered_map, custom hash functions, collisions and a chaining example in C++.
std::stack is LIFO and std::queue is FIFO. Learn their operations, underlying containers and real use cases with complete C++ examples.
Learn what a binary heap is in C++, how it is stored in an array, and how to use std::priority_queue, std::make_heap and a hand-written max heap.
A binary search tree keeps keys ordered for fast lookup. See a modern C++ implementation with unique_ptr, deletion cases, traversal and complexity.
A tree in C++ is a hierarchy of nodes. See a modern binary search tree built with unique_ptr, how traversals work and when std::set is the better choice.
Learn how to use std::queue and how to write your own fixed-capacity circular queue in modern C++, with runnable examples and complexity notes.
Learn what a stack is in C++, how to use std::stack, and how to build array and linked-list stacks with templates, std::optional and smart pointers.
A C++ linked list is a chain of nodes joined by pointers. See std::list, a leak-free singly linked list built with unique_ptr, and when a vector is the better choice.
new allocates and constructs a typed object and throws on failure, while malloc returns raw uninitialised bytes. Learn when each applies and what to use in modern C++.
Learn how the C++ move constructor differs from the copy constructor, when each is called, and why noexcept and the rule of zero matter.
The copy constructor builds a new object from an existing one. Learn when it is called, how to write a deep copy and when to skip it entirely.
See how the default constructor differs from parameterised, copy and move constructors in C++, with one runnable example and a comparison table.
A constructor initialises an object when it is created, and the destructor cleans it up when it is destroyed. See syntax, call order, virtual destructors and RAII.