Horje
check valid binary search tree c# Code Example
check valid binary search tree c#
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
check valid binary search tree java Code Example check valid binary search tree java Code Example
valid binary tree or not Code Example valid binary tree or not Code Example
c# string to char Code Example c# string to char Code Example
check valid binary search tree Code Example check valid binary search tree Code Example
vs code explorer font size Code Example vs code explorer font size Code Example

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