add sort function for linked list