1,2c1 < P R E L I M I N A R Y S P E C I F I C A T I O N < --- > R E V I S E D S P E C I F I C A T I O N 54c53,54 < as strings are inserted in the new table. --- > as strings are inserted in the new table. Pruning should run in time linear | > in the number of codes in the old string table. | 63c63,64 < source files for encode/decode (including a Makefile) as assignment 4. --- > source files for encode/decode (including a Makefile) as assignment 4. Your | > Makefile should create encode and decode as hard links to the same inode. | 107a108,111 > As discussed in class, encode and becode may use separate data structures | > (i.e., encode uses hashing with chaining and decode uses an array) or they | > can both use a single, combined data structure. | > 115c119,120 < all existing codes). --- > all existing codes). If the table is pruned, the number of strings is | > reduced and the number of chains may need to be reduced accordingly. | 123,124c128,129 < 2) Do you need separate arrays of structs for the (PREF,CHAR) pairs and the < hash nodes? --- > 2) How many copies of the (PREF,CHAR) pairs do you need to store? How many | > copies do you need when doubling the size of the table? When pruning? | 128c133,137 < 4) Implement encode and decode without worrying about how much storage you --- > 4) Which of the following variables (A or B) requires less space? | > struct {int a; char b;} A[100]; | > struct {int a[100]; char b[100];} B; | > > 5) Implement encode and decode without worrying about how much storage you 143,144c152,154 < setvbuf (stdin, bin, _IONBF, 0); < setvbuf (stdout, bout, _IONBF, 0); --- > static char bin[64], bout[64]; // Use small static buffers | > setvbuf (stdin, bin, _IOFBF, 64); | > setvbuf (stdout, bout, _IOFBF, 64); | 179c189,198 < be free()-ed before exiting, it must all be reachable at that time. --- > be free()-ed before exiting, it must all be reachable at that time; i.e., | > valgrind should report 0 bytes lost. | > > Note: When main() returns, storage for all variables stored on the stack | > is freed before valgrind checks for unreachable heap storage. Thus if an | > argument or automatic local variable contained the only pointer to a block | > on the heap, valgrind will report that block as being unreachable. One | > solution is to call exit() instead of returning, so that stack storage is | > not freed. Another is to store the pointer in a global or static local | > variable (which is not stored on the stack). | 208c227 < * (20 points) implementing the -m option --- > * (30 points) implementing the -m option 221a242,245 > Here the number of bytes includes all storage in the data (= global and | > static local variables), heap (= malloc()-ed), and stack (= arguments and | > automatic local variables) segments and the limits apply att all times. | > 308,310c332,334 < H. When the -p WINDOW option creates a new table, it might not assign the same < code to a string; that is, the old code may no longer be valid either for < sending or as a prefix. --- > H. When the -p option creates a new table, it might not assign the same code to| > a string; that is, the old code may no longer be valid either for sending or| > as a prefix. | 404c428 < CS-323-10/22/20 --- > CS-323-11/03/20|