cocktail sort with namespace