BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Coffee Break Coding Challenge


@Ben wrote:

Did you try it with a 1.2 Candle power candle?


I would recommend a Chandelier for massively parallel processing. 😄

Message 21 of 26
(5,343 Views)

Ben wrote:

Inplace operations used in the 14th Century?

 

I realize memory used to be a scarce resource but then again... "There is nothing new under the sun." Eclesiastes


I wanted to wait for the comedy to run its course before pointing out that there is a big difference between creating an algorithm and implementing one. 

 

And yes, buffer copies were quite expensive in his day.

0 Kudos
Message 22 of 26
(5,329 Views)

Darin.K wrote:
I wanted to wait for the comedy to run its course before pointing out that there is a big difference between creating an algorithm and implementing one. 
And yes, buffer copies were quite expensive in his day.
  1. Can you provide a link to his work that addresses this challenge?
  2. How in the world did you connect the two?
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 23 of 26
(5,318 Views)
The reference is Vol. 4 of The Art of Computer Programming by Donald Knuth who also gave us LaTeX. The given example of lexicographic permutation generation is actually strings of digits so this was an easy connection. The other places I have used it were a bit more clever.

 

The unitialized SR in the code was my own abomination so the code only works once. 🙂
Message 24 of 26
(5,316 Views)

@Darin.K wrote:
The reference is Vol. 4 of The Art of Computer Programming by Donald Knuth who also gave us LaTeX. The given example of lexicographic permutation generation is actually strings of digits so this was an easy connection. The other places I have used it were a bit more clever.

 

The unitialized SR in the code was my own abomination so the code only works once. 🙂

I tried your solution yesterday, fixed the USR and promptly stopped trying to understand it. Smiley Indifferent  Seeing this algorithm in a classic text comforts me after being unable to generate the permutations of the number (hence, my solution that generates all numbers and checks them for matching digits).  Here's my next coffee-break reading topic.

 

You writing "lexicographic permutation generation is actually strings of digits" makes me think I should try to solve this challenge in Emacs LISP. 😛  First, where did I put my box of insiginficant, stupid parentheses...

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 25 of 26
(5,296 Views)

@jcarmody wrote:
[...] try to solve this challenge in Emacs LISP. [...]

(defun permutations (bag)
  "Return a list of all the permutations of the input."
  (if (null bag)
      '(())
      (mapcan #'(lambda (e)
                  (mapcar #'(lambda (p) (cons e p))
                          (permutations
                            (remove e bag :count 1))))
              bag)))


 

found here.   Wow!  It's time to develop a LabVIEW LISP node (a la LabPython)...

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 26 of 26
(5,281 Views)