added methods to implement stack functionality with SinglyLinkedList