groups array elements through a comparator function
array of elements to group
comparator function: return of 0 means should group, anything above means not group
array of arrays with grouped elements
groups array elements through a comparator function