C M S C     2 1 4
C o m p u t e r   S c i e n c e   I I
F a l l   2 0 0 3


Project #3 FAQ

(questions are listed in reverse chronological order)

List of Answers to FAQ

  • Can we assume the codebook values will remain unchanged? Will "halt" always be 0935 and "garble" always be 5555?

    You may NOT ASSUME that "halt" will always translate to 0935 and "garble" will always translate to 5555. We will test your project 3 on a different "codebook.txt" than you have been using. In other words, if you HARDCODED these values, your project will fail our tests. The ONLY thing you can hardcode is if you encounter a word that you can not translate (it is not a plural or part of an expression) you may replace it in checkcodebook() in Encoder with the word "garble". Then when you look up "garble" in codebook.txt (your bst) it should always tranlate to the same 4-digit code (which is 5555 right now but will be changed for projects 3 and 4 tests.)

  • Are print() and inorder() in Bst the same?

    YES!

  • What gets passed into the locate() and search() functions in Bst?

    You should initialize "curr" or "child" to a COPY of the root and initialize "parent" to NULL since the root has no parent. In ModBst, you only pass in "curr" (a copy of the root) because each node already knows where its parent is located.

  • Will there be an extension on this project?

    No! The staff discussed this and determined that since there were no metro shutdowns, no power outages, and no hurricanes, there is no extension.

  • Can you go over how to handle a garble in Encoder and in Decoder?

    Glad you asked. They are handled differently in each. Let's handle one at a time:

  • Is the erase() function in Bst recursive?

    No! You can call locate() (which is recursive) to find where the node and its parent are, then determine which case you have -deleting a leaf, deleting a node with a right subtree, deleting a node with a left subtree, or deleting a node with 2 subtrees. By the way, if you start out with the node to be deleted has 2 subtrees, with right successor or left predecessor, you then will end up deleting only a leaf or a node with one subtree.

  • If a function must be recursive, does that mean we can't call a recursive helper function?

    As long as either the function itself is recursive or it calls a recursive function, you have satisfied the recursion.

  • How exactly does findMin() and findMax in Bst work?

    The pointer that is passed in is the root of some tree or subtree. The node passed in will point to the smallest node of that subtree after calling findMin() or will point to the largest node in that subtree after calling findMax(). Warning: yes it will change where root is pointing if you pass root into it.

  • How should the print() of the Bst (and inorder(), preorder() and postorder() look?

    The same as in Codebook: each pair is on a separate line. plaintext word followed by a single blank followed by 4-digit code followed by endl.

  • How can root be set to NULL in makeEmpty() in Bst and ModBst if the argument is not a reference?

    The comment was changed (see faq immediately below this one) to say that the function that calls this sets the root to NULL.




    See the class syllabus for policies concerning email
    Last Modified: Tue Oct 14, 2003
    left up down right home

    Web Accessibility