Aman Kumar has Published 91 Articles

C++ Program to Implement Cartesian Tree

Aman Kumar

Aman Kumar

Updated on 16-May-2025 16:54:51

498 Views

Cartesian Tree in C++A Cartesian tree is a binary tree derived from a sequence of distinct numbers. To construct a Cartesian tree, set its root to be the minimum number in the sequence, and then recursively construct its left and right subtrees from the subsequence before and after this number. ... Read More

C++ Program to find Median of Elements where Elements are stored in 2 different arrays

Aman Kumar

Aman Kumar

Updated on 15-May-2025 18:47:19

229 Views

The median is defined as the middle value of a sorted list of numbers, and the middle value is found by ordering the numbers in ascending order. Once the numbers are ordered, the middle value is called the median of the given data set. Here, in this article, we have ... Read More

Calculate range of data types using C++

Aman Kumar

Aman Kumar

Updated on 15-May-2025 16:01:08

4K+ Views

Here, we are going to learn how we can calculate the range of the different C++ data types such as signed data types (int, char, float, etc.) and unsigned data types (unsigned char, unsigned int, unsigned float, etc.). Calculating Range of Signed Data Types In C++, signed data types are ... Read More

Difference between std::vector and std::array in C++

Aman Kumar

Aman Kumar

Updated on 15-May-2025 15:56:01

24K+ Views

Both vectors and arrays are used to store collections of elements, but they differ significantly in how they manage their memory and flexibility. C++ std::vector A vector is a dynamic array that can be resized automatically when elements are added or removed. It is a part of the C++ STL ... Read More

Why we should avoid using std::endl in C++

Aman Kumar

Aman Kumar

Updated on 15-May-2025 15:52:30

773 Views

In this article, we will see why we should avoid the std::endl while printing lines into the console or a file. We use std::endl to create a new line after the current line. For a few lines of I/O operations, it is not causing any problems. However, a large number ... Read More

reference_wrapper in C++

Aman Kumar

Aman Kumar

Updated on 15-May-2025 15:45:44

532 Views

std::reference_wrapper is a class template in C++ that allows you to store references to objects or functions in a way that makes them copyable and assignable. Normally, C++ references can't be stored in standard containers like std::vector or std::list, because references are not copyable. std::reference_wrapper solves this problem by internally ... Read More

Calculation in parent and child process using fork() in C++

Aman Kumar

Aman Kumar

Updated on 15-May-2025 15:44:05

2K+ Views

The fork() function creates a new process by duplicating the current one. It allows developers to perform parallel tasks and manage resources efficiently. When fork() is called, it returns a value. If the value is greater than 0, then it is in the parent process. Otherwise, it is in the ... Read More

Program to print hollow pyramid and diamond pattern in C++

Aman Kumar

Aman Kumar

Updated on 15-May-2025 15:41:35

7K+ Views

In this article, we implement a C++ program to print a hollow pyramid and diamond pattern. We can create solid Pyramid patterns easily using a loop. To make it hollow, we have to add a few logics. Hollow Pyramid A hollow pyramid is a pattern where a pyramid shape is ... Read More

Chrono library in C++

Aman Kumar

Aman Kumar

Updated on 15-May-2025 15:38:25

827 Views

; is a C++ header that is included in C++11 or later versions and states the collection of types and functions to work with time. It is a part of the C++ Standard Template Library (STL). Why We Need It provides a precision-neutral concept by separating the durations and ... Read More

C++ Program to Count Inversion in an Array

Aman Kumar

Aman Kumar

Updated on 15-May-2025 15:36:22

877 Views

The inverse count of an array indicates how far or how close the array is from being sorted. If the array is already sorted, then the inverse count is zero, but if the array is sorted in reverse order, then the inverse count is maximum. Here we have given an ... Read More

Advertisements