You are on page 1of 1

ACSL

2007 - 2008 American Computer Science League Contest #4


Senior Division Solutions

1. Data Structures
1. 38
C

The binary search tree is shown on the


right. The path length is found by A H

adding 0 + 2*1 + 3*2 + 3*3 + 4*4 + 5


C E R

D L S

E I N S

2. Data Structures 2. S
The stack is constructed as follows:
BLE, BL, LB, LBAK, KABL, KA, AK, AKH, A, AO, OA, O, OSE,
ESO, ES. The next popped item is S since stacks are LIFO.
3. Prefix-Infix-Postfix
3. As Shown
prefix: / * + A B – B C  A C infix: ( (A+B)*(B+C))/(AC)
postfix: A B + B C - * A C  /

4. Prefix-Infix-Postfix 4. 16
4 3 * 9 7 + % 4 5 + 2  3 5 * @ / = (4*3)(9+7) %(4+ 5 )2 (3 *5) @ /
= ( 12 % 16 ) (9  2 ) 15 @ / = 48 ( 81@ 15 ) /
= 48 / 3 = 16

5. Digital Electronics 5. (1, 1, 1, 1)


The circuit translates to: (0, 1, 1, 1)
( A  ( AB  B  C ))CD (0, 0, 1, 1)
To be TRUE, C = 1 and D = 1 and ( A  ( AB  B  C )) = 1
If C = 1, then ( A  ( AB  B  1)) = ( A  ( AB  1))
= ( A  ( AB  0))
Now if A  1 , then 1  (1B  0)  0  ( B  0)
This is TRUE if B  1 Hence (1, 1, 1 , 1)
Now if A  0 , then 0  (0 B  0)  1  (0  0)  1
This is TRUE for B  * Hence (0, *, 1, 1)

You might also like