示例#1
0
        static void Main(string[] args)
        {
            Node test = new Node(10);

            Console.WriteLine(test.Add(5));
            Console.WriteLine(test.Add(3));
            Console.WriteLine(test.Add(12));
            Console.WriteLine(test.Add(11));

            test.Print();

            Console.WriteLine(test.FindNode(5));
            Console.WriteLine(test.FindNode(10));

            Console.WriteLine("Count: " + test.Count());

            test.FindNode(12).Add(15);

            test.FindNode(15).num = 35;

            test.Print();

            Console.WriteLine("Count: " + test.Count());

            Console.WriteLine(test.Remove(12));

            test.Print();

            Console.WriteLine("Count: " + test.Count());
        }
示例#2
0
        public int Count()
        {
            int count = 1;

            if (LNode != null)
            {
                count += LNode.Count();
            }
            if (RNode != null)
            {
                count += RNode.Count();
            }
            return(count);
        }