# Algorithm

- Initialize number counter to 0
- Loop through the linked list
- if current node value is equal to number, increment the counter
- 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; }

Filed under:
LinkList