FrequencyLinkedListNode GetWordCountsInLinkedList(List<string> strings) { FrequencyLinkedListNode prev=null; FrequencyLinkedListNode root= new FrequencyLinkedListNode(strings.First(),null,1); foreach (string str in strings.Skip(1)) { FrequencyLinkedListNode cur = root; while (cur != null && cur.word != str) { prev = cur; cur = cur.next; } if (cur == null) { prev.next = new FrequencyLinkedListNode(str, null, 1); } else { cur.frequency++; //ReArrangeList(root); } } return root; }