Live data from Hacker News

I Got a Knuth Check for 0x$3.00

nickdrozd.github.io

91–100 of 149 posts

Re: I Got a Knuth Check for 0x$3.00

#93

I wonder if anyone cashes these things? We should all gang up and cash these checks together and overdraw him. Or at least really screw up his check book balance.

It's not a real check though. He stopped sending real once in 2008 according to the article.

Re: I Got a Knuth Check for 0x$3.00

#94

Earlier quoted context omitted.

I bought an international edition of a text in college because it was priced significantly cheaper. And indeed, it had all the same problems, but they had been re-arranged, so when the professor assigned problems "5-15", I needed to know the mapping from the US 5-15 to the international version's numbers. Which, by quickly thumbing through another student's copy, I could generate pretty rapidly, but boy was that anno…

We had a professor that kept mappings for 2-3 versions behind and basically allowed you to buy the used book on Amazon for about $12 compared to $200 for the new one. It's these little things that make your professors stand out.

>$200 for a textbook with borderline extorsion sale tactics

That's the moment I fire up libgen

Re: I Got a Knuth Check for 0x$3.00

#95
post #72

> People also say that TAOCP is irrelevant or outdated or otherwise inapplicable to “real programming”. This also wrong. For instance, the first section after the chapter intro deals with the basic problem of searching for an item in an unsorted array. The simplest algorithm should be familiar to all programmers. Start your pointer at the head of the array, then do the following in a loop: Check if the current item i…

Certainly I'm not saying that this is the algorithm to use in all cases. It's not even obvious how you would implement the sentinel algorithm in a language like Python, not in idiomatic code anyway.

The point is that the book is written from the perspective of an actual programmer writing actual code and thinking about how it will run. Granted, he's writing in a pixie assembly language for an imaginary machine, but still, the thought process is similar to writing real code. He doesn't just figure out the big-O and call it a day, he works out the low-level details. The lesson in this case is that a lot of extra work can be done in a loop, even for the simplest of algorithms.

Now you might think, that's a truism, duh, any programmer knows that loops need to be fast. But what can I say? I read that section and spent a few hours thinking about it (even writing out some old-timey flowcharts), and I came out the other side writing better, faster code.

Re: I Got a Knuth Check for 0x$3.00

#96
post #94

Earlier quoted context omitted.

We had a professor that kept mappings for 2-3 versions behind and basically allowed you to buy the used book on Amazon for about $12 compared to $200 for the new one. It's these little things that make your professors stand out.

>$200 for a textbook with borderline extorsion sale tactics That's the moment I fire up libgen

Thus the error is that 1962 should be 1960. That’s it.

=== http://xurl.es/ycomjob

Re: I Got a Knuth Check for 0x$3.00

#97
post #89

Earlier quoted context omitted.

I had to try it myself but it looks like you are right! http://codepad.org/tw6EJMr4 i5-2500K: naive search found: 0, took 1856721 ns found: 0, took 1799554 ns found: 0, took 1908483 ns found: 0, took 1921622 ns found: 0, took 1856173 ns found: 0, took 1812736 ns found: 0, took 1819938 ns found: 0, took 1846232 ns found: 0, took 1821858 ns found: 0, took 1898503 ns average: 1854182.00 ns knuth search found: 0, took 19…

Kudos to you for actually doing the experiment! With a control case even! I wish I could give you ten upvotes.

Well kudos to you for having the right theory! I would have never assumed this behavior on modern CPUs.

That trick might still be useful in the embedded space - I had to try it on my samr21-xpro too (with only an 8kiB array and slightly modified code - http://codepad.org/aPOZraI2)

samr21 (Cortex M0+)

  naive search
  found: 0, took 1714 ticks
  found: 0, took 1713 ticks
  found: 0, took 1714 ticks
  found: 0, took 1714 ticks
  found: 0, took 1714 ticks
  found: 0, took 1713 ticks
  found: 0, took 1714 ticks
  found: 0, took 1713 ticks
  found: 0, took 1714 ticks
  found: 0, took 1714 ticks
  average: 1713 ticks

  knuth search
  found: 0, took 1372 ticks
  found: 0, took 1372 ticks
  found: 0, took 1372 ticks
  found: 0, took 1372 ticks
  found: 0, took 1372 ticks
  found: 0, took 1372 ticks
  found: 0, took 1372 ticks
  found: 0, took 1372 ticks
  found: 0, took 1372 ticks
  found: 0, took 1372 ticks
  average: 1372 ticks

Re: I Got a Knuth Check for 0x$3.00

#98
post #72

> People also say that TAOCP is irrelevant or outdated or otherwise inapplicable to “real programming”. This also wrong. For instance, the first section after the chapter intro deals with the basic problem of searching for an item in an unsorted array. The simplest algorithm should be familiar to all programmers. Start your pointer at the head of the array, then do the following in a loop: Check if the current item i…

Certainly I'm not saying that this is the algorithm to use in all cases. It's not even obvious how you would implement the sentinel algorithm in a language like Python, not in idiomatic code anyway. The point is that the book is written from the perspective of an actual programmer writing actual code and thinking about how it will run. Granted, he's writing in a pixie assembly language for an imaginary machine, but s…

> The point is that the book is written from the perspective of an actual programmer writing actual code and thinking about how it will run.

Sure, I don't dispute that in the least. All I'm saying is that if you want to argue that TAOCP is not dated you could have chosen a better example.

Re: I Got a Knuth Check for 0x$3.00

#99
post #94

Earlier quoted context omitted.

We had a professor that kept mappings for 2-3 versions behind and basically allowed you to buy the used book on Amazon for about $12 compared to $200 for the new one. It's these little things that make your professors stand out.

>$200 for a textbook with borderline extorsion sale tactics That's the moment I fire up libgen

Some Easy Step...........bit.ly/2PhPO3w

Re: I Got a Knuth Check for 0x$3.00

#100
post #72

> People also say that TAOCP is irrelevant or outdated or otherwise inapplicable to “real programming”. This also wrong. For instance, the first section after the chapter intro deals with the basic problem of searching for an item in an unsorted array. The simplest algorithm should be familiar to all programmers. Start your pointer at the head of the array, then do the following in a loop: Check if the current item i…

Perhaps even more importantly, requiring the array to be mutable hurts composability in the age of multithreading, as it prevents the algorithm from being used concurrently on the same array by multiple threads.
Post reply on HN