Count Balanced Binary Trees of Height H in C++

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

395 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 child.Height-balanced binary tree − is defined as a binary tree in which the depth of the two subtrees of every node differ by 1 or 0 only. That is the height of the left subtree and the right subtree at every node has a maximum difference of 1.Following figure contains ... Read More

Sets of Pairs in C++

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

8K+ 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 can have values of different or same type. The class has member functions first() and second() to individually access the values in a pair.The order of pair elements is fixed (first, second). We can use pair to combine two heterogeneous values of different types.To access any element we use variable_name.first ... Read More

Set Operator in C++ STL

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

272 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 set s1 to another set. The parameter passed is set of the same type.Usage − set s1=s2;move :- set& operator=( set &&s1 ) −This moves the elements of set s1 into the calling set.Initializer list :- set& operator= (initializer_list ilist) −This version copies the values of the initializer list ilist ... Read More

Round Function in C++

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

16K+ 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 round() after C++ 11 standarddouble round( double D )float round( float F )long double round( long double LD )double round ( T var )Note − The value returned is the nearest integer represented as floating point, i.e for 2.3 nearest value returned will be 2.0 and not 2.Following program is ... Read More

Rotation of a Point About Another Point in C++

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

1K+ 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 angle and magnitude. polar(mag, angle) returns a complex number.Rotation of point X about a point YTo rotate a point about another point, we will use translation in which movement of all coordinates occur in a particular direction.Steps to rotate X about Y.Translate X to Y, so Y becomes the new ... Read More

Relational Operators on STL Array in C++

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

343 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
Updated on 28-Jul-2020 10:33:43

118 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 encounters an abnormal condition. The program crashes due to such exceptions if they are not handled properly using try-catch blocks. Following program crashes due to divide by zero exception −Example#include int main(){    int num1=10;    int num2=0;    int quotient=num1/num2;    printf(" Quotient is: %d", quotient);    return ... Read More

Range-Based For Loop in C++

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 : range-expression ) loop statementrange-declaration − it is declaration of a variable of type same as the type of elements of range-expression. Often the auto keyword is used to automatically identify the type of elements in range-expression.range-expression − any expression used to represent a sequence of elements. Also Sequence of ... Read More

Test Remote Computer Connectivity Using PowerShell

Chirag Nagrekar
Updated on 28-Jul-2020 09:23:26

3K+ Views

To test the remote connectivity using PowerShell Test-Connection command is used. PowerShell also supports the Ping command and both the commands are almost produce the same output but Test- Connection cmdlet supports advanced parameters. See how both commands output look.Ping Command −PS C:\Temp> ping Test1-Win2k16 Pinging Test1-Win2k16 [192.168.0.108] with 32 bytes of data: Reply from 192.168.0.108: bytes=32 time Test-Connection Test1-win2k16 Source    Destination    IPV4Address    IPV6Address ------    -----------    -----------    ----------- ADDC    Test1-win2k16    192.168.0.108 ADDC    Test1-win2k16    192.168.0.108 ADDC    Test1-win2k16    192.168.0.108 ADDC    Test1-win2k16    192.168.0.108You can reduce the number of checks using ... Read More

Enable/Disable Enhanced Protection Mode in Internet Explorer using PowerShell

Chirag Nagrekar
Updated on 28-Jul-2020 09:19:57

1K+ Views

Internet Explorer (IE) supports the enhanced protection mode for more security of the browser and the same can be enabled/disabled using PowerShell. Let see when we can find this setting in IE.Internet Explorer → Internet Options → Advanced → Enable Enhanced Protection ModeWe can modify this setting using PowerShell and for that registry settings need to be done. Registry value can be found under Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main and the key name is Isolation for enhanced protection mode.PMIL – To disable IE enhanced protection ModePMEM – To Enable IE enhanced protection modeTo make the changes using the script.Enable IE EP modeIf there ... Read More

Advertisements