emory-courses / dsa-java

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

[HW1] Must subarrays sizes be the same? LSDRadixSort? #93

Closed HowardYutingHou closed 4 years ago

HowardYutingHou commented 4 years ago

I have two questions

  1. Can the subarrays have different sizes, or must their sizes be the same?
  2. Are we expected to use LSDRadixSort, as it could theoretically boost the running speed?
HowardYutingHou commented 4 years ago

Sorry, just noticed that the hw pages says the sizes can vary. How about LSDRadixSort?

marvinquiet commented 4 years ago

Yes, you can use the code you wrote or code provided by the course as long as it is faster

HowardYutingHou commented 4 years ago

I have a problem using LSDRadixSort, as it defines generic type to be Integer, while HybridSortHW takes T. So, I get an error when using LSDRadixSort in HybridSortHW. Could you give a hint how to deal with it?

JonathanKimchi commented 4 years ago

I believe since HybridSortHW takes T, you cannot use LSDRadixSort since there is no way to define the bounds of the buckets.

lujiaying commented 4 years ago

I have a problem using LSDRadixSort, as it defines generic type to be Integer, while HybridSortHW takes T. So, I get an error when using LSDRadixSort in HybridSortHW. Could you give a hint how to deal with it?

Please notice that, if using LSDRadixSort, it might lead to failure when dealing with negative integers. Also, As @JonathanKimchi mentioned, it can not pass compile phase due to <T>.

jdchoi77 commented 4 years ago

@HowardYutingHou currently, LDSRadixSoft assumes integer but the input can be any comparable keys in this homework so it may not always work.