Skip to content

all tests passing#48

Open
FaithKauwe wants to merge 1 commit intoAda-C16:masterfrom
FaithKauwe:master
Open

all tests passing#48
FaithKauwe wants to merge 1 commit intoAda-C16:masterfrom
FaithKauwe:master

Conversation

@FaithKauwe
Copy link

Hash Table Practice

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Why is a good Hash Function Important?
How can you judge if a hash function is good or not?
Is there a perfect hash function? If so what is it?
Describe a strategy to handle collisions in a hash table
Describe a situation where a hash table wouldn't be as useful as a binary search tree
What is one thing that is more clear to you on hash tables now

@chimerror
Copy link

Grabbing this to grade!

Copy link

@chimerror chimerror left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

I added some comments about your missing complexity calculations, and a bug when limiting the results in the top-k problem. However, as I have generally not been marking things Yellow for missing complexity calculations, and the problem is underspecified, I'm marking this Green.

@@ -5,15 +5,54 @@ def grouped_anagrams(strings):
Time Complexity: ?
Space Complexity: ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For both this and the top-K problem, complexity calculations are missing.

final_list.append(num)
else:
break
check_next += 1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this method of limiting the result to k values has the possibility of returning more than k values, particularly if there are ties. For example, given [1, 1, 1, 2, 2, 2, 3, 3, 4] with k = 2, [1, 2, 3] will be the returned result. Essentially, when i is zero both 1 and 2 will be added to final_list, then 3 will be added on the next iteration when i is one.

However, as our problem statement underspecifies how to handle ties, I do not think it's fair to ding you for this, I just wanted to call it to your attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants