emory-courses / dsa-java

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

[HW#2] #181

Closed HowardYutingHou closed 3 years ago

HowardYutingHou commented 3 years ago

Hello, could you please give the test cases you used to us? I think the way to implement autocomplete is very personal and subjective. Therefore, I am not sure what you expect exactly and I am not sure how you expect each edge case should behave. Therefore, could you provide the test cases code, so that at least I know how I failed the test cases? My code handles all the edges cases I come up with, as least.

jdchoi77 commented 3 years ago

@HowardYutingHou please take a look at the test cases we discussed during the lecture on Nov 11 from the recording. We used the same cases for grading. Feel free to reach out to TAs for specific cases you missed.

marvinquiet commented 3 years ago

Hi, I just checked your test result. It seems that you add both non-existing candidates and non-existing prefix into the trie tree.

As stated in the hw page "Your program should be able to handle prefixes or candidates that do not exist in the dictionary.". If clearly stated in class about the rule for non-existing candidates/prefix, this can be considered as a major logic problem.

marvinquiet commented 3 years ago

It was also well-explained here #160

Another thing is that you did not correctly deal with the empty string and input with whitespace, which is also stated at the hw page: Whitespaces are not allowed as input; thus, you should trim all input strings.

HowardYutingHou commented 3 years ago

Hi, I just checked your test result. It seems that you add both non-existing candidates and non-existing prefix into the trie tree.

As stated in the hw page "Your program should be able to handle prefixes or candidates that do not exist in the dictionary.". If clearly stated in class about the rule for non-existing candidates/prefix, this can be considered as a major logic problem.

Hi, thanks for your advice. The thing is, I don't think the rule for non-existing candidates/prefix is are stated in class. Adding them to the trie is just my solution. Do you mean, for non-existing candidates/prefix, we can simply return empty string?

HowardYutingHou commented 3 years ago

Hi, I just checked your test result. It seems that you add both non-existing candidates and non-existing prefix into the trie tree. As stated in the hw page "Your program should be able to handle prefixes or candidates that do not exist in the dictionary.". If clearly stated in class about the rule for non-existing candidates/prefix, this can be considered as a major logic problem.

Hi, thanks for your advice. The thing is, I don't think the rule for non-existing candidates/prefix is are stated in class. Adding them to the trie is just my solution. Do you mean, for non-existing candidates/prefix, we can simply return empty string?

I mean empty list

marvinquiet commented 3 years ago

Please check Dr. Choi's response in #160. I believe that he states it multiple times in the class and also please check the recording.