0

The Dutch national problem is this problem : I have a sequence of characters x^k (k >= 3) My goal is to transform this sentence into a dutch flag, that is to say :

xxx gives RWB

xxxx gives RWBB

xxxxx gives RWWBB

xxxxxx gives RRWWBB

...

with R <= W <= B <= R+1

I want to design a Turing machine with one ribbon, and a complexity of n.log(n) . The fact is , the standard algorithm is using swaps and I cannot use it, which is not available (not efficient enough) in this kind of Turing machine ....

Do you know how to do it ? :)

aronisstav
  • 7,755
  • 5
  • 23
  • 48
  • Yes, I know how to do it. Think about efficient unary <-> binary conversions. I don't have time to write down all the details. – David Eisenstat Nov 07 '15 at 18:28
  • ....Aha x) In fact I have a an algorithm which writes a binary number for getting the third of the word . The main problem is, I can write it in n.log(n) (at the left of the word) but when I want to place the third of the word while reading my binary number, it has a complexity in n^2 . I don't manage to get my conversion binary ->unary efficient enough ... – Koala EnChocolat Nov 08 '15 at 13:17
  • Possible duplicate of [Dutch national flag on a Turing Machine](http://stackoverflow.com/questions/4080769/dutch-national-flag-on-a-turing-machine) – aronisstav Nov 09 '15 at 19:40

0 Answers0