using System.Collections.Generic;
public static void Main()
Console.WriteLine("Hello World");
BinaryTree tree = new BinaryTree();
int[] source = {9,4,6,20,170,15,1};
tree.root = tree.CreateBinaryTree(tree.root,source,0);
if(tree.HasPath(tree.root,15)){
tree.routes.ForEach((item)=>{Console.Write(" {0} ",item);});
public List<string> routes = new List<string>();
public void InOrder(Tree root){
Console.Write(" {0} ",root.val);
public Tree CreateBinaryTree(Tree root,int[] source,int index){
if(index < source.Length){
Tree temp = new Tree(source[index]);
root.right = CreateBinaryTree(root.right,source,2*index+2);
root.left = CreateBinaryTree(root.left,source,2*index+1);
public bool HasPath(Tree root, int toFind,string rotation = null){
if(root == null){ return false;}
if(root.val != toFind){ routes.Add(rotation); return false;}
if(!HasPath(root.right,toFind,"right")){
if(!HasPath(root.left,toFind,"left")){