after testing naive approach on sorting