18 August 2010

Slow software, lolz

I've been trying to make a fast algorithm to validate propositional logic for our little website. I came up with something that I thought was faster, but I just worked out it would take BILLIONS UPON BILLIONS OF EONS to validate worst case input of only size 100.

I don't think a user would enjoy waiting for that length of time!

Edit:

I was getting such long times because I'd assumed the input would be ill-formed: and even in that case I never thought of converting it into well formed sentences. Doh!

Then all you need to do is check for sentences of the form

A_0 implies A_1 .... implies A_n implies NOT A_m where m < n

Fast solution.
For any of A_x in A_n:
if A_x == A_m the sentence is invalid

O(N) time, about 2 lines of code....


...a lot better than my 460 line symbolic reasoning engine I wrote in the last three days which runs at O(N^N).....
I am a tool.

No comments:

Post a Comment