コード例 #1
0
 public static int Length(kyu6LinkedListsLength_Count head)
 {
     if (head == null)
     {
         return(0);
     }
     else
     {
         return(1 + Length(head.Next));
     }
 }
コード例 #2
0
        public static int Count(kyu6LinkedListsLength_Count head, Predicate <int> func)
        {
            if (head == null)
            {
                return(0);
            }
            var count = 0;

            while (head != null)
            {
                if (func(head.Data))
                {
                    count++;
                }
                head = head.Next;
            }
            return(count);
        }
コード例 #3
0
 public kyu6LinkedListsLength_Count(int data)
 {
     this.Data = data;
     this.Next = null;
 }