Sorted algorithm add support for dict sorting