Some points in response to current questions about the radix tree asn7... 1) Note that unlike the previous binary tree this assignment will not separate the search and tree modification operations. Therefore the insert() function will do all of the search and the insertion/counting operations that are needed as you go through the characers for each word. **ALSO notice that root in this program is an actual node that already exists and is initiall full of NULLs rather than just being a pointer like the root we used in the earlier binary tree assignment. 2) You will also notice that the memory consumption of the program will be rather large if you do it directly as I am suggesting. This is OK and I'll talk about how that can be reduced when we go over my solution and also by a slightly more complex data structure. 3) I was not able to understand how to recode the characters in assignment 7, for instance how to assign 0 to a.? You need to think about the way that characters are represented in the computer as numbers. The ASCII code, see the tables below, are the standard way this is done. However, all that really matters for us is that when we have a single quoted letter in a program that is really just the ASCII numeric value of that letter. Therefore if we have a character variable c then the four statements ... c = 'a'; c = 97; c = 0141; c = 0x61; are exactly equivalent and we can print all of these by ... printf("%c %d 0%o 0x%x\n", c, c, c, c) which prints exactly that same number, 96, 4 different ways. Since the ASCII codes are sequential and the representations are just numbers then we can use them in computational expressions. Therefore, the value of 'b' is just 'a'+1. As another example, if we have a sequence of ASCII digit characters we can convert them to a numeric value by ... int number = 0; // the number we are trying to produce char *p = "12345"; // the string of digit characters for(p = "12345", isdigit(*p); p++) // process each digit char number = number * 10 + (*p - '0'); printf("number is %d\n", number); // now we have the numer 12345 Notice that this relies on all of the digit's ASCII codes having sequentially increasing values. Looking at the code tables below we see that the code for the digit '0' is 48. Therefore, in the example above each loop shifts the number value to the left by one decimal digit position by multiplying by the base 10 radix and then adding the *p - '0' part that subtracts '0' from the code value for each of the digits 12345 in turn. In our assignment 7 situation we are not dealing with digit codes but letter codes and we only have to handle them one at at time such that we map 'a' to 0 on to 'z' as 25. The extra code value of 26 for a non letter, in our case the null termination character, is a special case. 4) Also, while considering a particular letter in a word, how are we going to assign it to its corresponding node? I'm not sure I understand the real question here but... Notice that our node structre contains 27 outgoing pointers struct node *np[TWID]; rather than just the 2 pointers, left and right, that we had in our previous comparison based binary tree assignment. You need to use the individual letters in the word to select the particular np[] path from the current node. The reason we recode the alphabetic letters and the null terminator into the 0 to 26 code is so we can use these recoded values directly as indexes into the np[] array going out of each node and thereby lead us to the next node. 5) Could you please explain the how the recursive tree walk function works? I am a little confused on how to get the function to walk the tree and collect the stats. Go back and look at the solution to our asn5 which is on the web page. Your treewalk() function this week will use the same basic strategy as the tree_stats() functio from asn5. However, rather than just the 2 pointers, left and right, that we needed to follow during the asn5 recursion you will have to consider all 27 possible paths in as 7. The actual stats collection is the usual addition of counts etc. Note that ... char most_frequent_word[MAXLEN]; char deepest_word[MAXLEN]; are actual character arrays so the reconstructed character strings will have to be copied back there according to the reconstructed character string that corresponds to your current node during the recursion. You will use ... char current[MAXLEN]; // keep track of the current word during recursion int treewalk_level = -1; // keep track of the recursion depth to keep track of this information. 6) Could you explain again how we are supposed to track the recursion level so that our result will agree with yours? The recursion level simultaneously reflects both the depth of the tree nodes and the number of nested calls during treewalk(). I had used a similar method in the extended solution to assignment 5 that is in http://www.psc.edu/~awetzel/asn05soln.c In that case the global variable level was initialized to 0 and then increased it by 1 on every entry to tree_stats() and decereased by 1 on every return. In that case it was use just to measure the tree depth and it was natural to think of the first level as level 1. This week the treewalk_level works exactly the same way. However it is more convenient to think of the first level as level 0. That is why I've already initialize treewalk_level to -1. This is important so that you will be able to insert the character that corresponds to your current treewalk() position in the right place inside of the current[] array. This also affects the result ... the deepest word is at level 19 Note that contemporaneousness has 19 alphabetic characters but the actual string length, and the number of recursion levels, is 20 when you include the termination character. This way the treewalk_level agrees with the strlen() of the corresponding string even though it is one less than the number of bytes needed to hold that string when it includes the terminator. In order to make your treewalk_level increase exactly once every time you enter treewalk() and decrease exactly once when you leave it will be most convenient if you structure your treewalk() code so it runs straight from top to bottom with no other returns inside other than just falling out the bottom. It will however include a loop and that loop will contain recursive calls to other instances of treewalk(). - - - Decimal | 0 NUL| 1 SOH| 2 STX| 3 ETX| 4 EOT| 5 ENQ| 6 ACK| 7 BEL| | 8 BS | 9 HT | 10 NL | 11 VT | 12 NP | 13 CR | 14 SO | 15 SI | | 16 DLE| 17 DC1| 18 DC2| 19 DC3| 20 DC4| 21 NAK| 22 SYN| 23 ETB| | 24 CAN| 25 EM | 26 SUB| 27 ESC| 28 FS | 29 GS | 30 RS | 31 US | | 32 SP | 33 ! | 34 " | 35 # | 36 $ | 37 % | 38 & | 39 ' | | 40 ( | 41 ) | 42 * | 43 + | 44 , | 45 - | 46 . | 47 / | | 48 0 | 49 1 | 50 2 | 51 3 | 52 4 | 53 5 | 54 6 | 55 7 | | 56 8 | 57 9 | 58 : | 59 ; | 60 < | 61 = | 62 > | 63 ? | | 64 @ | 65 A | 66 B | 67 C | 68 D | 69 E | 70 F | 71 G | | 72 H | 73 I | 74 J | 75 K | 76 L | 77 M | 78 N | 79 O | | 80 P | 81 Q | 82 R | 83 S | 84 T | 85 U | 86 V | 87 W | | 88 X | 89 Y | 90 Z | 91 [ | 92 \ | 93 ] | 94 ^ | 95 _ | | 96 ` | 97 a | 98 b | 99 c |100 d |101 e |102 f |103 g | |104 h |105 i |106 j |107 k |108 l |109 m |110 n |111 o | |112 p |113 q |114 r |115 s |116 t |117 u |118 v |119 w | |120 x |121 y |122 z |123 { |124 | |125 } |126 ~ |127 DEL| Octal |000 NUL|001 SOH|002 STX|003 ETX|004 EOT|005 ENQ|006 ACK|007 BEL| |010 BS |011 HT |012 NL |013 VT |014 NP |015 CR |016 SO |017 SI | |020 DLE|021 DC1|022 DC2|023 DC3|024 DC4|025 NAK|026 SYN|027 ETB| |030 CAN|031 EM |032 SUB|033 ESC|034 FS |035 GS |036 RS |037 US | |040 SP |041 ! |042 " |043 # |044 $ |045 % |046 & |047 ' | |050 ( |051 ) |052 * |053 + |054 , |055 - |056 . |057 / | |060 0 |061 1 |062 2 |063 3 |064 4 |065 5 |066 6 |067 7 | |070 8 |071 9 |072 : |073 ; |074 < |075 = |076 > |077 ? | |100 @ |101 A |102 B |103 C |104 D |105 E |106 F |107 G | |110 H |111 I |112 J |113 K |114 L |115 M |116 N |117 O | |120 P |121 Q |122 R |123 S |124 T |125 U |126 V |127 W | |130 X |131 Y |132 Z |133 [ |134 \ |135 ] |136 ^ |137 _ | |140 ` |141 a |142 b |143 c |144 d |145 e |146 f |147 g | |150 h |151 i |152 j |153 k |154 l |155 m |156 n |157 o | |160 p |161 q |162 r |163 s |164 t |165 u |166 v |167 w | |170 x |171 y |172 z |173 { |174 | |175 } |176 ~ |177 DEL| Hex | 00 NUL| 01 SOH| 02 STX| 03 ETX| 04 EOT| 05 ENQ| 06 ACK| 07 BEL| | 08 BS | 09 HT | 0A NL | 0B VT | 0C NP | 0D CR | 0E SO | 0F SI | | 10 DLE| 11 DC1| 12 DC2| 13 DC3| 14 DC4| 15 NAK| 16 SYN| 17 ETB| | 18 CAN| 19 EM | 1A SUB| 1B ESC| 1C FS | 1D GS | 1E RS | 1F US | | 20 SP | 21 ! | 22 " | 23 # | 24 $ | 25 % | 26 & | 27 ' | | 28 ( | 29 ) | 2A * | 2B + | 2C , | 2D - | 2E . | 2F / | | 30 0 | 31 1 | 32 2 | 33 3 | 34 4 | 35 5 | 36 6 | 37 7 | | 38 8 | 39 9 | 3A : | 3B ; | 3C < | 3D = | 3E > | 3F ? | | 40 @ | 41 A | 42 B | 43 C | 44 D | 45 E | 46 F | 47 G | | 48 H | 49 I | 4A J | 4B K | 4C L | 4D M | 4E N | 4F O | | 50 P | 51 Q | 52 R | 53 S | 54 T | 55 U | 56 V | 57 W | | 58 X | 59 Y | 5A Z | 5B [ | 5C \ | 5D ] | 5E ^ | 5F _ | | 60 ` | 61 a | 62 b | 63 c | 64 d | 65 e | 66 f | 67 g | | 68 h | 69 i | 6A j | 6B k | 6C l | 6D m | 6E n | 6F o | | 70 p | 71 q | 72 r | 73 s | 74 t | 75 u | 76 v | 77 w | | 78 x | 79 y | 7A z | 7B { | 7C | | 7D } | 7E ~ | 7F DEL|