-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use python set instead of python list for maintaining points #13
Comments
Ah nice find, I'm hoping to find a few spare moments this weekend to get this fix in a push to pypi. I'l report back here when those are done. |
Note that if you use sets, points cannot be lists, since lists are unhashable. But if they are lists, they can be converted to tuples. Ultimately one can just say that input points must be hashable objects. |
@carsonfarmer Any update on this? |
I don't have much time to spend on this library these days. I'd be happy to accept a quick PR with this change if you're interested? |
@Rakesh4G tried to do this recently but it didn't work... maybe there's some trick here we need. |
Hmmm, ok. I can take a look at this. Can @Rakesh4G elaborate on what "didn't work" in this context means? |
I noticed that point removal is O(n) as it uses list remove function. Instead one can switch to using sets, which would make it close to O(1) for removal. All other operations don't really change by switching to sets as far as I can see.
The text was updated successfully, but these errors were encountered: