NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Knight of NI
altenbach
Posts: 22,876

Re: 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. :smileyvery-happy:


LabVIEW Champion . Oh, by the way, I work for peanutsKudos .

Trusted Enthusiast
Darin.K
Posts: 3,353
0 Kudos

Re: Coffee Break Coding Challenge


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.

Active Participant
jcarmody
Posts: 1,555
0 Kudos

Re: Coffee Break Coding Challenge


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
CLD
Trusted Enthusiast
Darin.K
Posts: 3,353

Re: Coffee Break Coding Challenge

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. :smileyhappy:
Active Participant
jcarmody
Posts: 1,555

Re: Coffee Break Coding Challenge

[ Edited ]

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. :smileyhappy:

I tried your solution yesterday, fixed the USR and promptly stopped trying to understand it. :smileyindifferent:  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. :smileytongue:  First, where did I put my box of insiginficant, stupid parentheses...

Jim
CLD
Active Participant
jcarmody
Posts: 1,555
0 Kudos

Re: Coffee Break Coding Challenge


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
CLD
By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page