Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
trees
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here Console.WriteLine("Hello, world!"); } } public static void PrintFromTEnd(binnode<int>t) { if(t!=null) { PrintFromTEnd(t.getLeft()); PrintFromTEnd(t.getRight()); PrintFromTEnd(t.getValue()); } } public static bool IsLeafy(binNode<int> t) { return t.getleft() == t.GetRight(); } public static int HowMuchLeafs(binNode<int> t) { if (t == null) return 0; if (IsLeafy(t)) return 1; return HowMuchLeafs(t.getRight()) + HowMuchLeafs(t.getLeft()); } public static int sumOfTheTree(binNode<int> t) { if (t == null) return 0; return t.getValue() + sumOfTheTree(t.getleft()) + sumOfTheTree(t.getRight()); } public static int SumRight(binNode<int> t) { if(t==null) return 0; int l=o,r=o; if (t.getLeft()!=null) l+=SumRight(t.getLeft()); if(t.getRight()!=null) R+=SumRight(t.getRight()); return t.GetRight().GetValue()+l+R; } public statc int HowLonelySons(BinNode<int>t) { if(t==null) return o; if (t.GetRight()!=null&&t.getLeft()==null) return 1+HowLonelySons(t.getLEft())+HowLoneltSons(t.GetRight()); else if(t.GetRight()==null&& t.GetLeft()!=null) return 1+HowLonelySons(t.getLEft())+HowLoneltSons(t.GetRight()); return HowLonelySons(t.getLEft())+HowLoneltSons(t.GetRight()); } public static int HowMuchZogy(binNode<int>t) { if(t==null) return 0; int l=HowMuchZogy(t.getLeft()); int R=HowMuchZogy(t.getRight()); if (t.getValue()%2==0) return 1+l+r; return l+R; } public static int HowMuchLikeX(binNode<int> t, int x) { if (t==null) return 0; int l=HowMuchLikeX(t.getleft(),x); int R=howMuchLike(t.getRight(),x); if(t.GetValue()==x) return 1+l+R; return l+R; } public static int HowMuchGrandpas(binNode<int>t) { if(t==null||Isleafy(t)) return 0; int l=HowMuchGrandpas(t.getLeft()); int R=HowMuchGrandpas(t.GetRight()); if(!IsLeafy(t.getLeft())||!IsLeafy(t.getRight())) return 1+l+R; return l+R; } public static int SumEiZogyOfLonely(binNode<int>t) { if(t==null ||) return 0; int l=SumEiZogyOfLonely(t.getLeft()); int R=SumEiZogyOfLonely(t.getRight()); if(t.getLeft()!=null&&t.getRight()==null) { if (t.getLeft().getValue()%2==1) return t.getLeft().getValue()+l+R; } else if(t.getLeft()==null&& t.getRight()!=null) { if (t.getright().getvalue()%2==1) return t.getright().getvalue()+l+R; } return l+R; } public static int countQ14(binNode<int>t) { if(t==null|| t.getRight()==null|| t.getlLeft()==null) return 0; return 0; int l=countQ14(t.getleft()); int R=countQ14(t.GetRight()); if(t.getleft().GetValue()==t.GetRight().GetValue()) return 1+l+R; return l+R: } public static int COuntQ15(binNode<int>t) { if(t==null||IsLeafy(t)) return 0; int l=countQ15(t.getleft()); int R=countQ15(t.GetRight()); if (t.getValue()<t.getLeft.GetValue()||t.getValue()<t.getRight().getValue()) return 1+l+R; return l+R; } public static int NumberOfNodesOnLevel(BinTreeNode<int>t, int level) { return NumberOfNodesOnLevel(t, level, 0) } public static int NumberOfNodesOnLevel(BinTreeNode<int>t, int level, int Clevel) { if(t==null) return 0; if (level==Clevel) return 1; int l=NumberOfNodesOnLevel(t.getleft(),level,Clevel+1); int R=NumberOfNodesOnLevel(t.getright(),level,Clevel+1); return l+R; } public static int SumOfNodesOnLevel(BinTreeNode<int>t, int level) { return SumOfNodesOnLevel(t,level,0); } public static int SumOfNodesOnLevel(BinTreeNode<int>t, int level,int levelC) { if(t==null) return 0; if(level==levelC) return t.GetValue(); int l+=SumOfNodesOnLevel(t.getleft(),level,Clevel+1); int R+=SumOfNodesOnLevel(t.getright(),level,Clevel+1); return l+R; } public static int HighTree(binNode<int>t) { public stativ int HighTree(t, 0) } public static int HighTree(binNode<int>t) { if (t==null) return 0; int l+=HighTree(t.getLeft()); int R+=highTree(t.getRight()); return MathMax(l,R)+1; } public static int MaxValue(BinTreeNode<int> t) { if (IsLeaf(t)) return bt.Getvalue(); int maxLeft = MaxValue(t.GetLeft()); int maxRight = MaxValue(t.GetRight()); return Math.Max(t.Getvalue(), Math.Max(maxLeft, maxRight)); } }
run
|
edit
|
history
|
help
0
Hello word
Move 2 ushort to 1 int
Login Silencioso
inheritance with virtual orride
nn
LCM Q 3
Using Events/Delegates to Subscribe To A Service - Emails
WallPascal
Get Error Message Based on String
eze