There is something error when delete node, should 'delete front' or 'delete rear' outside the body of if cycle.