added method to delete node with 3 cases( beginning,middle and end)