Introduce OrderedData and ComparableData to make algorithms more flexible in supporting primitive and non-primitive types