using LinkedList data structure