Posts by Prabhnoor Singh

Author Biographical Info: Not available

C++ program to change a Binary Tree so that every node stores sum of all nodes in left subtree

By Prabhnoor Singh

Update every node of a binary tree such that it stores the sum of all nodes in its left subtree including its own in C++. What is a Binary Tree? A non- linear data structure in whi.... Read More

C++ program to check if binary representation of a number is palindrome

By Prabhnoor Singh

For a non-negative number x, print Yes if the binary representation of x is a palindrome else print No in C++. The binary representation of a number with leading 0’s will not.... Read More

Implement upper_bound() and lower_bound() in Ordered Set in C++

By Prabhnoor Singh

For a sorted set and a key, print the lower bound and the upper bound of the key K in the set in C++ or print -1 if the element is not present or out of bounds. First, we need to .... Read More

Stack unwinding in C++

By Prabhnoor Singh

In this tutorial, we will learn about stack unwinding in C++. Stack Unwinding is the removal of the function call stack items at runtime. In C++, the function call stack is searche.... Read More

std::has_virtual_destructor in C++ with examples

By Prabhnoor Singh

In this article, we will learn about the has_virtual_destructor in C++ with examples. This function of C++ STL tells us if any template type T has a virtual destructor or not. Head.... Read More

C++ program to find next Smaller of next Greater in an array

By Prabhnoor Singh

For every element in the array, print the next smaller of the next greater element. Also print -1 for elements who do not either the next greater or next smaller of the next greate.... Read More

Iterator Invalidation in C++

By Prabhnoor Singh

There are many cases in which our iterator gets invalidated while we iterate any container. This can be due to many reasons including the change in size or shape of the container w.... Read More

Static Const Member Variable in C++

By Prabhnoor Singh

In this article, we will be learning about the static const member variable in C++ which is a combination of const which is a type qualifier and static which is a storage specifier.... Read More