Sunidhi Bansal has Published 1100 Articles

Maximum and Minimum Product Subsets in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 28-Jul-2020 10:54:51

269 Views

We are given with an array of integers of size N. The goal here is to find the Maximum and Minimum Product Subsets. We will do this by taking two product variables, one for minimum product found so far minProd and other for maximum product found so far, maxProd.While traversing ... Read More

Count Balanced Binary Trees of Height h in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 28-Jul-2020 10:52:45

309 Views

We are given with the height H of a binary tree. The goal is to find the number/count of balanced Binary Trees of given height.A binary tree − is a tree data structure in which each node has at most two children, which are the left child and the right ... Read More

Sets of pairs in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 28-Jul-2020 10:50:15

7K+ Views

Set in C++ is an associative container and contains unique elements. All the elements once added to a specific cannot be modified. One can only remove and add elements in order to change them.Pair is defined under header and is used to couple together two pair values. The pair ... Read More

set operator= in C++ STL

Sunidhi Bansal

Sunidhi Bansal

Updated on 28-Jul-2020 10:47:26

160 Views

The function operator= is used in sets to copy one set (or move to another in C++ STL. It behaves as a normal ‘=’ assignment operation for sets. There are there overloaded forms of this function −copy :- set& operator= (const set& s1) −This function copies all the elements in ... Read More

C++ Rule Of Three.

Sunidhi Bansal

Sunidhi Bansal

Updated on 28-Jul-2020 10:45:11

591 Views

The rule of three is one of the rules of C++ under rules of thumb for building an exception safe code. These rules prescribe how default members of the class should be used for exception free practice.The rule of three is also known as the Law of Big Three or ... Read More

round() in C++.

Sunidhi Bansal

Sunidhi Bansal

Updated on 28-Jul-2020 10:42:58

15K+ Views

The round() function in C++ is used to round off the double, float or long double value passed to it as a parameter to the nearest integral value. The header file used to use the round() function in a c++ program is or .Following are the overloaded versions of ... Read More

Rotation of a point about another point in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 28-Jul-2020 10:41:29

881 Views

Rotation of a point X about origin is by an angle θ in anti-clockwise direction is done by − X by θ about origin anti-clRotateockwise: X*polar( 1.0, θ ).Here, the function polar for complex numbers is defined under header file and is used to find a complex number using phase ... Read More

Relational Operators on STL Array in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 28-Jul-2020 10:39:05

247 Views

There are six relational operators for comparison of operands of the same type. These are >,

Count columns to be deleted to make each row sorted in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 28-Jul-2020 10:33:43

53 Views

The abnormal behavior of C++ programs often leads to program crash. You may have encountered problems like Segmentation fault, Aborted, Floating point exception etc. Following are sample programs that may help you to understand the reasons for a C++ program crash.ExceptionsExceptions in C++ are responses of a program when it ... Read More

Range-based for loop in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 28-Jul-2020 10:30:46

4K+ Views

The range based for loop is added in C++ 11 standard and is a more compact form of its traditional equivalent. The range based for loop is used to iterate over elements of a container from beginning to end. The syntax for range-based for loop is as follows −Syntaxfor( range-declaration ... Read More

Advertisements