first method for linked list data structure