push pop operation in stack algorithm