title: Is it possible to add boolean conditions into a Binary Search Tree?
body: <p>I am trying to implement a Decision tree which from my understanding , a Decision Tree is a Binary Tree with boolean conditions , feel free to correct me if i am wrong. I am trying to implement an Add() function with a parameter of a template  where i want to add a boolean conditions. I am using this link : <a href="http://csharpexamples.com/c-binary-search-tree-implementation/" rel="nofollow noreferrer">http://csharpexamples.com/c-binary-search-tree-implementation/</a> for help.I was trying to compare a boolean value with an int value knowing it won't work so i switched to using a template  . This is my first time trying to implement a Binary Search Tree.</p>
  <p>Here is the code for my node class:</p>
  <pre><code>    using System.Collections;
      using System.Collections.Generic;
      
      
      public class BST_NodeClass&lt;E&gt; 
      {
         public BST_NodeClass&lt;E&gt; LeftNode { get; set; }
         public BST_NodeClass&lt;E&gt; RightNode { get; set; }
         public BST_NodeClass&lt;E&gt; Data { get; set; }
      };
  </code></pre>
  <p>Here is the code for my Binary Search Tree :</p>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class BST&lt;E&gt; where E : System.IComparable&lt;E&gt;
  {
      public BST_NodeClass&lt;E&gt; Root { get; set; }
  
      public bool Add (E condition) 
      {
          BST_NodeClass&lt;E&gt; before = null, after = this.Root;
          while (after!= null)
          {
              before = after;
              if(condition &lt; after.Data)//Is new node in the left tree?
              {
                  after = after.LeftNode;
                  
              }
              else if (condition &gt; after.Data)//Is the new node in the right tree?
              {
                  after = after.RightNode;
              }
              else
              {
                  //Exist same value
                  return false;
              }
              BST_NodeClass&lt;E&gt; newNode = new BST_NodeClass&lt;E&gt;();
              newNode.Data = condition;
              if (this.Root == null)//Tree is empty
                  this.Root = newNode;
              else
              {
                  if (condition &lt; before.Data)
                      before.LeftNode = newNode;
                  else
                      before.RightNode = newNode;
              }
              return true;
          }
      }
          
  };
  </code></pre>