Algorithm

  1. Initialize number counter to 0
  2. Loop through the linked list
    1. if current node value is equal to number, increment the counter
  3. return counter

Code

        public int NumberCount(T number)
        {
            int count = 0;
            Node<T> temp = this.head;

            while (temp != null)
            {
                if (temp.Data.Equals(number))
                {
                    count = count + 1;
                }
                temp = temp.Next;
            }
            return count;
        }