An answer to “real world haskell” Graham-scan exercice that actually works and is not so slow

I finally wrote a working implementation of the Graham scan algorithm that is not so slow. You can read it here. It turned out that my previous rant was wrong. The “loop” part can indeed run in O(n), and the complexity is that of the sort. I however have a sound excuse : the Wikipedia complexity analysis is wrong.

So it now runs in a way that is not horribly slow, and should be easier to read :

$ time ./graham2 < points.dat > /tmp/solution
real    0m43.122s
user    0m42.840s
sys    0m0.190s
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s