Skip to content
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

Open
CMCDragonkai opened this issue Jun 7, 2018 · 6 comments
Open

Comments

@CMCDragonkai
Copy link

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.

@carsonfarmer
Copy link
Owner

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.

@CMCDragonkai
Copy link
Author

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.

@CMCDragonkai
Copy link
Author

@carsonfarmer Any update on this?

@carsonfarmer
Copy link
Owner

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?

@CMCDragonkai
Copy link
Author

@Rakesh4G tried to do this recently but it didn't work... maybe there's some trick here we need.

@carsonfarmer
Copy link
Owner

Hmmm, ok. I can take a look at this. Can @Rakesh4G elaborate on what "didn't work" in this context means?

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

No branches or pull requests

2 participants