Friday, February 03, 2017

A programming language breakthrough!

In honor of our team member Nandu, I have invented a new control structure: NON DO.

Like many looping constructs like DO and DO… WHILE, it takes an argument saying how many times the loop should execute. But in this instance, the parameter tells NON DO how many times NOT to perform the code inside the loop body. So:

NON DO (1)
    print(”Hello world!”)

Will not print “Hello world!” one time, while:

NON DO(1000)
    print(”Hello world!”)

Won’t print “Hello world!” 1000 times.

My original run-time analysis rigorously proved that this construct was of order Θ(1) run-time complexity (the proof is too long for the margin of this web site to hold!), but I incorporated a system call inside the loop conditional to sleep 1 / n milliseconds before not executing the loop body n times, and now it runs in O(1 / n), gifting computer scientists an example of an algorithm that executes in n-1 time.


4 comments:

  1. Will it accept non-integer values, so that I can use NON DO (0.001) for a one second delay?

    And will NON DO (0) take infinite time to execute, or just never complete?

    ReplyDelete
    Replies
    1. Well that's ridiculous: how can we not do something a fractional number of times?!

      NON DO(0)

      I'm running it now. I'll be back to you as soon as the loop finishes...

      Delete
    2. That reminds me of the time that a technician at work argued that fractional Hertz made no sense. How can you have 0.1 Hz, or 10.5 Hz? You have to have full cycles.

      Delete
  2. NON DO(1) {
    NON DO(1) {
    PRINT("Hello world!);
    }
    }

    The inner loop's action is to not print "Hello world!" once. So the outer loops's action is to not not print "Hello world!" once, meaning we print it once. And that's O(1).

    So I think this control structure is more of a NO GO, than a NON DO.

    ReplyDelete

The insidious ideology

"In contrast to its crueler competitor ideologies, liberalism is more insidious: as an ideology, it pretends to neutrality, claiming n...