adding a helper function to construct singly linked list, not compiled, not tested, you know where I'm writing this code from