Horje
check valid binary search tree Code Example
check valid binary search tree
public bool IsBinaryTree(Node node, int min = int.MinValue, int max = int.MaxValue)
{
    if (root == null)
    	return true;
    if (node.data < min || node.data > max)
    	return false;
        
    return  IsBinaryTree(node.leftChild,min,node.data-1) &&
    		IsBinaryTree(node.rightChild,node.data+1,max);
}

// node Structure
    public class Node
    {
        public int data;
        public Node leftChild;
        public Node rightChild;
        public Node(int data)
        {
            this.data = data;
        }
    }




Csharp

Related
vs code explorer font size Code Example vs code explorer font size Code Example
unity set list of strings Code Example unity set list of strings Code Example
c# sort array string by length Code Example c# sort array string by length Code Example
making a list of chars in c# Code Example making a list of chars in c# Code Example
print in c# unity Code Example print in c# unity Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8