emory-courses / dsa-java

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

[HW2] #183

Closed sherr-an closed 3 years ago

sherr-an commented 3 years ago

Hi, I know that sounds silly, but I do not understand why I am not passing the homework tests and barely getting any points... There might be a key in the homework requirement that I misunderstood (and still do not get), because my submission passed my own tests well. Could you help me take a look at my repository? Thank you.

marvinquiet commented 3 years ago

Hi,

I just tested your code. Taking the simplest case, the prefix is "she", your output is

[she, shea, shed, shee, shel, shem, shen, sher, shes, shew, shear, sheas, sheat, sheaf, sheal, shean, sheds, shedu, sheep, sheer];

As you can tell by eye, when it becomes to 5 characters, it is not ordered by alphabet. This is a major logic problem and I am not sure when you test it, did you find this problem..

Wenjing

marvinquiet commented 3 years ago

Also, it seems that your code does not handle empty string or whitespaces.

sherr-an commented 3 years ago

Hi,

I just tested your code. Taking the simplest case, the prefix is "she", your output is

[she, shea, shed, shee, shel, shem, shen, sher, shes, shew, shear, sheas, sheat, sheaf, sheal, shean, sheds, shedu, sheep, sheer];

As you can tell by eye, when it becomes to 5 characters, it is not ordered by alphabet. This is a major logic problem and I am not sure when you test it, did you find this problem..

Wenjing

Thank you for the help! I did not notice the problem when testing... As for empty string, I thought we should return an empty list and intentionally designed it... Sorry

marvinquiet commented 3 years ago

You still have time refining it and I think for alphabetical order, you an modify it within two lines

sherr-an commented 3 years ago

You still have time refining it and I think for alphabetical order, you an modify it within two lines

Thank you. I have pushed one line of code to sort, although I do not feel very positive that it will help me pass a lot more tests, as I believe the problem comes from my logic mistake with not sorting the map. I will greatly appreciate it if you could retest my code. Besides, I actually attempted the extra credit but unfortunately made a mistake by creating another java file for the new data type. I have moved it under the correct java file, and it would be great if you can test it as well. Sorry and I am only hoping that the ec could boost me into a decent grade...Thanks a lot.

marvinquiet commented 3 years ago

I think yes, by sorting the map you will get some test cases correct.

I tried to put your Freq.java into the class and tried to test extra, but you may need to know that your extra should also first pass the basic cases and then do your frequencies.

sherr-an commented 3 years ago

I think yes, by sorting the map you will get some test cases correct.

I tried to put your Freq.java into the class and tried to test extra, but you may need to know that your extra should also first pass the basic cases and then do your frequencies.

Thanks for the information. I think I found a way to sort the map in one line and I updated the files!