# ------------- Example output --------------------------- $ make gcc -c heap_test.c -o heap_test.o gcc -c heap.c -o heap.o gcc -c test_framework.c -o test_framework.o gcc -c utility.c -o utility.o gcc heap_test.o heap.o test_framework.o utility.o -o heap_test gcc -c heap_stats.c -o heap_stats.o gcc heap_stats.o heap.o utility.o -o heap_stats gcc -c huffman.c -o huffman.o gcc -c huffman_test.c -o huffman_test.o gcc utility.o heap.o huffman.o test_framework.o huffman_test.o -o huffman_test gcc -c run_huffman.c -o run_huffman.o gcc -lm utility.o heap.o huffman.o run_huffman.o -o run_huffman $ make test ./heap_test && ./huffman_test --- test heap --- 1 ok node creation 2 ok node data 3 ok node weight 4 ok heap creation descending=FALSE 5 ok heap size 6 ok heapify worked 7 ok push worked 8 ok pop works 9 ok repeated pop sorts 'em 10 ok heap creation descending=TRUE 11 ok heap size 12 ok heapify worked 13 ok push worked 14 ok pop works 15 ok repeated pop sorts 'em 1..15 All tests successful. -- test huffman -- 1 ok new_code 1..1 All tests successful. $ make clean rm *.o $ ./heap_stats -- analyze heap creation -- size steps 100 92 100 90 100 84 300 277 300 276 300 280 1000 938 1000 932 1000 944 3000 2811 3000 2787 3000 2807 10000 9389 10000 9380 10000 9419 30000 28257 30000 28194 30000 28102 $ ./run_huffman char ascii freq code ---- ----- ---- ---- 0x0a '\n' 22446 111010 0x20 ' ' 194695 110 0x21 '!' 1741 1110111111 0x22 '"' 2856 111011110 0x24 '$' 2 1111110010000100000 0x26 '&' 2 1111110010000100001 0x27 ''' 2848 111011011 0x28 '(' 200 1111110010001 0x29 ')' 200 1111110010010 0x2a '*' 45 011011111001111 0x2c ',' 18947 100110 0x2d '-' 5740 11101110 0x2e '.' 7250 11111101 0x30 '0' 123 11111100100111 0x31 '1' 123 0110111001010 0x32 '2' 54 111111001001100 0x33 '3' 45 011011111001110 0x34 '4' 34 011011111001100 0x35 '5' 52 111111001000011 0x36 '6' 31 1111110010011010 0x37 '7' 47 111111001000000 0x38 '8' 47 111111001000001 0x39 '9' 31 1111110010011011 0x3a ':' 192 1110110100111 0x3b ';' 4144 01100011 0x3f '?' 999 0110001011 0x41 'A' 2378 011011110 0x42 'B' 1364 1110110011 0x43 'C' 1042 0110111000 0x44 'D' 661 11101100101 0x45 'E' 908 11111100101 0x46 'F' 732 11101101010 0x47 'G' 575 01101110011 0x48 'H' 1294 1110110001 0x49 'I' 3344 111111000 0x4a 'J' 243 011011100100 0x4b 'K' 140 0110111110010 0x4c 'L' 737 11101101011 0x4d 'M' 675 11101101000 0x4e 'N' 981 0110001000 0x4f 'O' 775 11101111100 0x50 'P' 991 0110001010 0x51 'Q' 320 111011010010 0x52 'R' 640 11101100100 0x53 'S' 1966 1111110011 0x54 'T' 2203 011011101 0x55 'U' 179 1110110100110 0x56 'V' 134 0110111001011 0x57 'W' 1210 0110111111 0x58 'X' 15 11111100100001001 0x59 'Y' 283 011011111000 0x5a 'Z' 34 011011111001101 0x5b '[' 2 1111110010000100010 0x5d ']' 2 1111110010000100011 0x5f '_' 26 1111110010000101 0x61 'a' 74115 1000 0x62 'b' 15238 1111111 0x63 'c' 21100 111000 0x64 'd' 36996 10010 0x65 'e' 114117 000 0x66 'f' 19743 100111 0x67 'g' 19918 101000 0x68 'h' 60487 0010 0x69 'i' 61039 0011 0x6a 'j' 818 11101111101 0x6b 'k' 7798 0110000 0x6c 'l' 41315 10101 0x6d 'm' 22230 111001 0x6e 'n' 63573 0101 0x6f 'o' 67362 0111 0x70 'p' 15970 011001 0x71 'q' 1224 1110110000 0x72 'r' 50519 11110 0x73 's' 61139 0100 0x74 't' 84350 1011 0x75 'u' 26137 111110 0x76 'v' 8285 0110110 0x77 'w' 20565 101001 0x78 'x' 991 0110001001 0x79 'y' 16321 011010 0x7a 'z' 589 01101111101 -- analysis -- Total bytes (bits) in original file is 1198687 (9589496). Number of different codes = 81 Average code length = 10.1358 with standard deviation = 4.17149 Number of coded bits is 5408571 excluding table itself Compression ratio (without table) is 0.56401