Re: I Need Help



On May 1, 1:04?pm, OwlHoot <ravensd...@xxxxxxxxxxxxxx> wrote:
On May 1, 12:04 am, "mensana...@xxxxxxxxxxx" <mensana...@xxxxxxx>
wrote:



[..]

I never said it was the BEST algorithm. That wasn't the question.
And besides, MS-Access can't execute Pascal or C. And even if it
could, you sometimes need such output in a query to link to other
database structures, so the practice isn't nearly as pathetic
as you imagine. Of course, it's intractable if you ask for too much,
but you think a C implementation isn't also intractable if you ask
for all possible 12 letter permutions of 26 letters?

[..]

We need to distinguish simplicity of expression v. runtime
simplicity, where I'd interpret the latter as "overhead"
in some sense, and perhaps a third consideration also
needs throwing into the pot - conceptual simplicity.

Yes, the SQL expression is much shorter and simpler looking
than the full expression of an algorithm in terms of code.
So in that sense you're correct.

Also, runtime simplicity is open to interpretation, depending
on where you place the "ground level" so to speak, in other
words what you consider atomic operations. If your PC user
is not in a position to use a programming language, but
they have a database package installed and are comfortable
with SQL, then yes again the SQL solution is best and, being
only a single statement cannot be bettered (unless one can
code the Johnson-Trotter algorithm as a stored procedure ;-)

But as a hacker, I tend to think "closer to the iron" i.e.
in terms of machine intructions. Anyone with a rudimentary
grasp of how database engines work knows the SQL solution
will use several orders of magnitude more machine opcodes
to implement than the busy-looking psuedo-code in which
each step is (or, depending on the compiler, could be)
moreorless one-to-one with machine instructions.

And I like to think "closer to the problem". When I'm trying to
solve a linear congruence, pointers and memory allocation are
the furthest thing from my mind. That's why there are high level
languages so that you can focus more on the problem than
the implementation.

First of all, simplicity of expression doesn't always mean sacrificing
simplicity of runtime. Using Python & GMPY, I can solve my
linear congruence by the simple expression

a0 = gmpy.divm(z,x,y)

and since the GMPY module (where the heavy lifting is done)
is itself a compiled C program, I get both simplicity of expression
and reasonable runtime simplicity.

Second, if you get too close to the iron, you can't even solve the
problem. I can't operate in a domain limited to 32 or 64 bits. I work
on problems having 50000 decimal digits.

Third, simplicity of expression means you can work on more
complicated problems. Anybody can solve a linear congruence,
but how many can solve a non-linear congruence? Ok, I made that
last term up. Not sure what you would call

a = (gmpy.divm(xyz[1]**(k-1)-prev_gen[2],xyz[1]-xyz[0],xyz[1]**(k-1))/
xyz[1]**(k-2))*xyz[1]**(k-1) + prev_gen[3]



What's more, if the database procedure is followed through
and expressed explicitly, even in an idealized sense, it will
involve many database-specific aspects that do not directly
relate to the algorithm (except in so far as they are needed
for the SQL solution to work). So in other words, the SQL
statement conceals many extraneous "concepts".

Such as the ability to generate the sub-sets of the Cartesian
Product: combinations with replacement, permutations without
replacement and combinations without replacement.

Does the Johnson-Trotter algorithm do that also? I haven't
tried it yet.


So in summary we're both right

That's fine as long as I'm not wrong.

(although I still think I'm more right than you on this,

I won't quibble about degrees of rightness as long as
we're both right. If I need a Carteian Product to answer
a question in rec.puzzles, I'm going for simplicity of
expression. If I'm trying to win a contest in Games
Magazine, I might break out the reference you cited.

Not that it would help.

<http://members.aol.com/mensanator/pig_ignorance.htm>

even if that makes me one of
the bad guys ;-)

Cheers

John R Ramsden


.



Relevant Pages

  • Re: I Need Help
    ... I never said it was the BEST algorithm. ... database structures, so the practice isn't nearly as pathetic ... We need to distinguish simplicity of expression v. runtime ... with SQL, then yes again the SQL solution is best and, being ...
    (sci.math)
  • Re: Quote from student, after teaching Pick
    ... I firmly agree about the language simplicity issue. ... I am afraid that I have to disagree on some points. ... very point of database design. ...
    (comp.databases.pick)
  • Re: compare strings
    ... > I am writing ans asp page that compares two different database ... Are you looking for a sql solution? ... tell us the type and version of database you are using. ... Please reply to the newsgroup. ...
    (microsoft.public.scripting.vbscript)
  • Problem with zero length string vs Null when Databinding
    ... I am writing a front end for an existing Access database (which i dont ... For simplicity, i am databinding all controls on the screen using an ... When i bind this column to a textbox, ... Field 'tblAddress.ContactPhoneNo' cannot be a zero-length string ...
    (microsoft.public.dotnet.framework.windowsforms.databinding)
  • Re: a locked table
    ... The database is opened exclusive ok. ... Any ideas what could be wrong on the server? ... / v \ Simplicity is Beauty! ...
    (microsoft.public.fox.programmer.exchange)