Taking out tail-adding which is O(n) but checks for duplicates in favour of adding elements to the head which is O(1) but duplicate checking is not done