taocp

The Art of Computer Programming exercise question: Chapter 1, Question 8

雨燕双飞 提交于 2019-12-20 23:32:37
问题 I'm doing the exercises to TAOCP Volume 1 Edition 3 and have trouble understanding the syntax used in the answer to the following exercise. Chapter 1 Exercise 8 Computing the greatest common divisor of positive integers m & n by specifying T j ,s j ,a j ,b j Let your input be represented by the string a m b n (m a's followed by n b's) Answer: Let A = {a,b,c}, N=5. The algorithm will terminate with the string a gcd(m,n) j T j s j b j a j 0 ab (empty) 1 2 Remove one a and one b, or go to 2. 1

The Art of Computer Programming exercise question: Chapter 1, Question 8

做~自己de王妃 提交于 2019-12-20 23:30:23
问题 I'm doing the exercises to TAOCP Volume 1 Edition 3 and have trouble understanding the syntax used in the answer to the following exercise. Chapter 1 Exercise 8 Computing the greatest common divisor of positive integers m & n by specifying T j ,s j ,a j ,b j Let your input be represented by the string a m b n (m a's followed by n b's) Answer: Let A = {a,b,c}, N=5. The algorithm will terminate with the string a gcd(m,n) j T j s j b j a j 0 ab (empty) 1 2 Remove one a and one b, or go to 2. 1

Knuth the art of computer programming ex 1.1.8

自闭症网瘾萝莉.ら 提交于 2019-12-06 03:45:34
问题 I can't figure out what Knuth meant in his instructions for an exercise 8 from Chapter 1.1. The task is to make an efficient gcd algorithm of two positive integers m and n using his notation theta[j] , phi[j] , b[j] and a[j] where theta and phi are strings and a and b - positive integers which represent computational steps in this case. Let an input be the string of the form a^mb^n . An excellent explanation of Knuth's algorithm is given by schnaader here. My question is how this may be

How does division work in MIX?

≡放荡痞女 提交于 2019-12-06 03:23:23
问题 Can someone explain to me how division in MIX (from TAOCP by Knuth) works on a byte-to-byte basis? rA = |-| . . . .0| rX = |+|1235|0|3|1| The memory location 1000 contains |-|0|0|0|2|0| . When you execute the operation DIV 1000 the registers become rA = |+|0|617|?|?| rX = |-|0|0|0|?|1| Now I understand the signs on rA and rX , but in what order are the bytes of rAX filled and which divisions are done? If DIV 1000 leads to every bit divided by 2, then I would expect rAX = |+|617|0|1|0|-|0|1|0

How does division work in MIX?

纵饮孤独 提交于 2019-12-04 07:38:57
Can someone explain to me how division in MIX (from TAOCP by Knuth) works on a byte-to-byte basis? rA = |-| . . . .0| rX = |+|1235|0|3|1| The memory location 1000 contains |-|0|0|0|2|0| . When you execute the operation DIV 1000 the registers become rA = |+|0|617|?|?| rX = |-|0|0|0|?|1| Now I understand the signs on rA and rX , but in what order are the bytes of rAX filled and which divisions are done? If DIV 1000 leads to every bit divided by 2, then I would expect rAX = |+|617|0|1|0|-|0|1|0|1|1| in which rA contains the division results and rX the remainders (filled from the right side). I'm

Knuth the art of computer programming ex 1.1.8

こ雲淡風輕ζ 提交于 2019-12-04 07:02:47
I can't figure out what Knuth meant in his instructions for an exercise 8 from Chapter 1.1. The task is to make an efficient gcd algorithm of two positive integers m and n using his notation theta[j] , phi[j] , b[j] and a[j] where theta and phi are strings and a and b - positive integers which represent computational steps in this case. Let an input be the string of the form a^mb^n . An excellent explanation of Knuth's algorithm is given by schnaader here . My question is how this may be connected with the direction given in the exercise to use his Algorithm E given in the book with original r

The Art of Computer Programming exercise question: Chapter 1, Question 8

耗尽温柔 提交于 2019-12-03 06:39:29
I'm doing the exercises to TAOCP Volume 1 Edition 3 and have trouble understanding the syntax used in the answer to the following exercise. Chapter 1 Exercise 8 Computing the greatest common divisor of positive integers m & n by specifying T j ,s j ,a j ,b j Let your input be represented by the string a m b n (m a's followed by n b's) Answer: Let A = {a,b,c}, N=5. The algorithm will terminate with the string a gcd(m,n) j T j s j b j a j 0 ab (empty) 1 2 Remove one a and one b, or go to 2. 1 (empty) c 0 0 Add c at extreme left, go back to 0. 2 a b 2 3 Change all a's to b's 3 c a 3 4 Change all