emory-courses / dsa-java

Data Structures and Algorithms in Java
https://emory.gitbook.io/dsa-java/
42 stars 55 forks source link

[HW1] #119

Closed ddalama closed 3 years ago

ddalama commented 3 years ago

Hello,

my github repo: https://github.com/ddalama/dsa-java

For this line, return Comparator.naturalOrder().compare(array[i], array[j]);

I am getting the following error in my HybridSortHW: required type: T, T Provided: T, T

Please guide me as to how to solve this.

jdchoi77 commented 3 years ago

@ddalama you cannot call the compare() method from naturalOrder(). You need to define your own Comparator as a variable and call compare() from that variable.