Replies: 2 comments 4 replies
-
I think that if we add the argument to tell the number of occurrences to delete and we set the default value to 1, then we can reuse it. This method by itself will allow the client to be able to delete as many occurrences as it wants. And we should control internally that this number is not greater than the number of times this word has been inserted. On the other hand, if the client wants to delete all occurrences of one word, the easiest way I can think of is to have it do something like this:
And I would not like the client to do that. Instead, I think we should have a different method Did I make myself clear? Does it sound good? |
Beta Was this translation helpful? Give feedback.
-
I added a preliminary version of this functionality (check here implementation.py). Tests are here test_trie.py It would be great if you could take a look. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I was thinking about supporting deleting a string.
There could be 2 interpretations, which don't conflict with each other:
Both things can be implemented clearly by adding an argument to the method that specifies which behavior is required. We can even add an argument that tells the number of occurrences to delete.
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions