emory-courses / dsa-java

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

[HW2] Extra Credit Clarification #148

Closed mihirpatil001 closed 4 years ago

mihirpatil001 commented 4 years ago

For the extra credit portion, do we need to return for the first element the most frequent candidate without regard to prefix? Or should the most frequent candidate be prefix-dependent? For example, if we did:

  1. getCandidates(“sh”)
  2. pickCandidates(“sh”, “shy”)
  3. pickCandidates(“sh”, “shy”)
  4. pickCandidates(“sh”, “shy”)
  5. getCandidates(“sh”)
  6. getCandidates(“ai”)
  7. pickCandidates(“ai”, “aim”)
  8. getCandidates(“ai”)
    • Should getCandidates(“ai”) here return “aim” first or “shy” first?
lujiaying commented 4 years ago

do we need to return for the first element the most frequent candidate without regard to prefix?

Not quite sure I get the point. Could you provide some clues about where it requires returning candidates without prefix?

mihirpatil001 commented 4 years ago

I guess I'm trying to ask: Does the most frequent candidate returned depend on the prefix, or are we just using the most frequently picked candidate overall?

So in the example above, “shy” is picked the most when prefix is “sh”. But if we use a different prefix such as “ai”, would “shy” still be considered the most frequent candidate to be returned first? Or would “shy” not be, since “shy” was not the most frequently picked candidate for the prefix “ai”?

lujiaying commented 4 years ago

Thanks for the detailed response.

I guess I'm trying to ask: Does the most frequent candidate returned depend on the prefix, or are we just using the most frequently picked candidate overall?

For the majority of cases, candidates rely on prefix. In other words, "shy" not returned if prefix is "ai".

Unless some special case, please refer to https://github.com/emory-courses/dsa-java/issues/146