Questions tagged [knuth]

Donald E. Knuth is a computer scientist, best known as the author of the series of books on algorithms The Art of Computer Programming and the creator of the TeX typesetting system.

80 questions
5
votes
1 answer

How does the "Man Or Boy" Knuth test work?

Can anyone explain how the Man Or Boy Test returns a value of -67? I tried in vain to write down the result, or trace it with a debugger. Any help would be appreciated. A list of different implementations can be found here.
CaptainCasey
  • 1,311
  • 1
  • 14
  • 21
5
votes
2 answers

Unordered map for naive c++ solution

I have a C++ assignment where I have to devise a naive solution to the Knuth problem with the container that I have chosen and study the performance data that is generated. See problem below: Three million men with distinct names were laid…
wilcode
  • 627
  • 2
  • 9
  • 24
5
votes
1 answer

The Data Structure of Knuth's Dancing Links Algorithm

I am sorry if my question sounds stupid because my data structure understanding is not very good. I've been reading about Knuth's Dancing Links algorithm and pretty much understand how it basically works. It's mentioned that dancing link's data…
JrL
  • 221
  • 6
  • 19
4
votes
2 answers

What's the best way to read code in CWEB format in Windows?

Donald Knuth has a large number of programs to read on his page. But they are mostly in a "strange" CWEB format... What could be the best way to make them appropriately readable in Windows?
Max Galkin
  • 16,264
  • 9
  • 63
  • 108
4
votes
1 answer

Java: How to implement Dancing Links algorithm (with DoublyLinkedLists)?

I am trying to implement Knuth's Dancing Links algorithm in Java. According to Knuth, if x is a node, I can totally unlink a node by the following operations in C: L[R[x]]<-L[x] R[L[x]]<-R[x] And revert the unlinking by: L[R[x]]<-x R[L[x]]<-x What…
Tai
  • 101
  • 1
  • 1
  • 8
4
votes
0 answers

what are examples of exact cover problems in real world applications?

In computer science, the exact cover problem is a decision problem to determine if an exact cover exists. The exact cover problem is NP-complete[1] and is one of Karp's 21 NP-complete problems.[2] The exact cover problem is a kind of constraint…
yul gurz
  • 63
  • 6
4
votes
1 answer

Knuth–Morris–Pratt algorithm DFA based`?

I want to learn how the Knuth–Morris–Pratt algorithm works. I watched this tutorial form the Princeton University https://www.youtube.com/watch?v=iZ93Unvxwtw . In this Video they use a table, with length of the alphabet = number of lines and length…
Asker
  • 411
  • 3
  • 12
4
votes
4 answers

Arithmetic operations in donald knuth's Mix assembly language

I have been reading Donald Knuth's The Art of Programming, Volume 1, in which MIX is used as the assembly language. In the section where Knuth talks about arithmetic operations in MIX, I didn't understand how the subtraction, multiplication and…
coderasp
  • 123
  • 1
  • 7
4
votes
1 answer

Exact cover using Dancing Links

After going through this question I tried to implement Dancing Links to solve only the exact cover problem, following is the code taken from here and modified (It is Column-Row structure, I needed Row-Column strucuture). It works fine except that it…
kintoki
  • 318
  • 2
  • 11
4
votes
5 answers

Verify Knuth shuffle algorithm is as unbiased as possible

I'm implementing a Knuth shuffle for a C++ project I'm working on. I'm trying to get the most unbiased results from my shuffle (and I'm not an expert on (pseudo)random number generation). I just want to make sure this is the most unbiased shuffle…
Adam Maras
  • 24,360
  • 5
  • 60
  • 89
4
votes
2 answers

KMP failure function calculation

My professor solved the kmp failure function as follows: index 1 2 3 4 5 6 7 8 9 string a a b a a b a b b ff 0 1 2 1 2 3 4 5 1 From other texts I checked online, I found out it might be wrong, I went back to confirm from him again and he told…
Dennis
  • 41
  • 1
  • 1
  • 4
3
votes
2 answers

What is a time complexity for Algorithm X for sudoku?

I've found here a statement that Algorithm X for sudoku has O(N^3) time complexity where N is a board size. That's maybe logical, since for sudoku the binary matrix to compute has N^3 rows. But that makes sudoku problem solvable in a polynomial…
tkrishtop
  • 501
  • 1
  • 5
  • 16
3
votes
1 answer

What is the meaning of "ENT1 *" in TAOCP MIX assembly language?

In the book The Art of Computer Programming Volume 1, third edition, I'm having some hard time understanding the meaning of the following MIX assembly language instruction: ENT1 *, which appears on page 189 of the book. (p.189) For example, if we…
nglee
  • 1,818
  • 7
  • 28
3
votes
1 answer

Knuth's Algorithm X for exact cover with restricted block sizes

The famous algorithm for exact cover problem is given by Donald Knuth called Knuth's Algorithm X. Input: List of subsets of a Universal sets Output: All the possible disjoint subset whose union is Universal set Suppose the input is {ab, ac, cd, c,…
NARAYAN CHANGDER
  • 315
  • 3
  • 12
3
votes
2 answers

knuthBendix algorithm cannot be parallelized by Control.Parallel?

I am trying to apply knuthBendix to large sets of rewriting rules. Thus, I try to let it work on different sets in parallel. As en example, I try to run: import Control.Parallel import Control.Parallel.Strategies import…