What is Graph?

A graph is a non-linear data structure that consists of a collection of nodes (vertices) connected by edges. It is used to represent relationships between different entities or elements. Graphs are widely used in various fields, including computer science, social Read More …

Space Complexity

Introduction: Understanding the space complexity of algorithms is crucial for optimizing performance and resource utilization in computer science. In this article, we’ll delve into the concept of space complexity, exploring its significance, key considerations, and providing practical examples to illustrate Read More …

Type erasure by void*

Type erasure is a technique that allows you to store objects of different types in a container or pass them around as function parameters without knowing their specific type at compile time. One way to achieve type erasure in C++ Read More …

Return Type Resolver

The return type resolver is a feature introduced in C++14 that allows the compiler to automatically deduce the return type of a function based on its implementation. It is commonly known as “automatic return type deduction” or “auto return type.” Read More …

Constexpr and Consteval

constexpr and consteval are both keywords used for compile-time evaluation and optimizations. They are used to indicate that certain expressions or functions can be evaluated at compile time rather than runtime, which can lead to improved performance and code optimization. Read More …

Virtual destructor

A virtual destructor is used when you have a base class with a virtual function and you want to ensure that the destructor of the derived class is called properly when deleting an object through a pointer to the base Read More …

Comparator

A comparator is a function or an object used to define the ordering or comparison between two elements. It is often used in sorting algorithms or data structures like sets and maps. Here’s an example of how to use a Read More …

Function Pointer

A function pointer is a variable that can store the address of a function. It allows you to call a function indirectly by using the pointer. This feature is particularly useful when you want to pass a function as an Read More …

Rule of zero

The “Rule of Zero” is a principle in C++ that suggests avoiding explicit resource management in your classes whenever possible. The rule states that if a class doesn’t need to manage any resources (such as dynamically allocated memory) or doesn’t Read More …