For example
if the input is:
Output should be false:
As 4 in the left sub-tree is greater than the root value(3)
If the input is:
Output should be true
Consider the Binary Tree:
Pre-order traversal(root) is traversing the node then left sub-tree of the node and then the right sub-tree of the node.
So the pre-order traversal of above tree will be:
1 2 4 5 3 6 7
In-order traversal(root) is traversing the left sub-tree of the node then the node ...
For example if the inputs are:
Example:1
a)
b)
Output should be true.
Example:2
If the inputs are:
a)
b)
Output should be false.
Pseudo code for the same:
boolean sameTree(node root1, node root2){
if(root1 == NULL && root2 == NULL)
return true;
if(root1 == NULL ...
A binary tree is BST if it satisfies any one of the following condition:
It is empty
It has no subtrees
For every node x in the tree all the keys (if any) in the left sub tree must be less than key(x) and all the keys (if any) in the right sub tree must be greater than key(x).
So a straightf...
Note: These instructions are targeted at .NET Core 1.0.4 & 1.1.1 SDK 1.0.1 and higher.
When using binary archives to install, we recommend the contents be extracted to /opt/dotnet and a symbolic link created for dotnet. If an earlier release of .NET Core is already installed, the directory and ...
hosts: mysql
tasks:
name: Add mysql user
user:
name: mysql
shell: /sbin/nologin
name: install the latest version of libselinux-python
yum:
name: libselinux-python
state: latest
name: install perl
yum:
name: perl
state: latest
name: remove the mysql-libs package
y...