262 BINARY TREES [CHAP. 10
10.37. Write a program which reads the social security numberSSSof an employee and prints the employee’s record. Test
the program using (a) 165-64-3351; (b) 135-46-626; and (c) 177-44-5555.
10.38. Write a program which reads an integerKand prints the name of each male employee whenK=1 or of each female
employee whenK=2. Test the program using (a)K=2; (b)K=5; and (c)K=1.
10.39. Write a program which reads the nameNNNof an employee and deletes the employee’s record from the structure.
Test the program using (a) Davis; (b) Jones; and (c) Rubin.
10.40. Write a program which reads the record of a new employee and inserts the record in the file.
Test the program using:
(a) Fletcher; 168-52-3388; Female; 21 000;
(b) Nelson; 175-32-2468; Male; 19 000.
Answers to Supplementary Problems
10.17. (a) 4; D, E, G, H; (b) ABDEGH CF,
DBGEHACF, DGHEBF CA; (c) All three:
D,G,H,F.
10.18. (a) 4;C,D; (b)ABCDEF GH,CDBAFEHG,
DCBF HGEA; (c) All three:D,F,H.
10.19. (a) 5;D,F,G; (b)ABDF GCEH,BF GDAEH C,
GF DBH ECA; (c) All three:G,H.
10.20. (a) See Fig. 10-38(a); (b)ABDEH P QSCF KRL,
DBP H QSEACRKF L,DP SQHEBRKLF CA;
(c)d=6; hence 32≤END=64; here END=43.
10.21. (a) See Fig. 10-38(b); (b) 5;QACKF; (c)Q,K,
F,E,H.
Fig. 10-38
10.22. (a) See Fig. 10-39(a); (b)∗↑+x∗ 3 y 4 −a∗ 2 b 10.23. See Fig. 10-39(b).
Fig. 10-39