CSSE 230
Data Structures and Algorithm Analysis

Homework 3  -  45 points

To Be Turned In

See submission instructions below: one to a special dropbox, and most to the regular dropbox.

[Numbers in brackets] are problem numbers from the third edition of the Weiss textbook.

  1. (20 points) Essay on Professional Code of Ethics The purpose of this question is to familiarize yourself with the Code of Ethics of our discipline and to explain important ethical obligations associated with our discipline.

    The ACM's Code of Ethics states in section 1.5: Honor property rights including copyrights and patent

    1. Skim the Code of Ethics, but read 1.5 more closely.
    2. Write an essay (single-spaced, 12 pt, at most one page) in which you:
      1. State this ethical obligation and how it applies to your profession (as a student, software developer, or engineer) in general.
      2. Give three or more specific examples of professional activities where the ethical obligation applies. For each, explain how the obligation applies, especially why the activity is ethical or unethical according to this ethical obligation. 

      If you prefer, you may select another section of the ACM Code of Ethics as the basis for your essay.  If you do this, be sure to indicate which section you chose to elaborate.

      Grading: If no sys argument, -3. If argument only includes 1 reason why ethical/unethical, -1. If only give 2 examples, -1. If only give 1 example, -3. If examples not developed, -2.

    3. Submit your essay to the Code of Ethics drop box.
  2. You will submit the following to the WA3 dropbox:

  3. (10 points) It is useful to have a unique representation of binary trees that can be written compactly. For simplicity, we assume that each node of the tree will contain one Character. We represent a tree by a pair of strings, which I call chars and children. The chars is a pre-order listing of the contents of the nodes. The children string tells about the children of the corresponding node from chars as follows:

    2 The node has two children.
    0 The node has no children.
    L The node only has a left child.
    R The node only has a right child.

    For example:

    chars = "+a*-bcd"; children = "2022000";
    represents the tree in Weiss Figure 18.11 (a)

    chars = "7215349"; children = "220LR00";
    represents the tree in Weiss Figure 19.4 (a).

    1. What are the values of chars and children for the tree below?

    2. For a different tree we have:

       chars = "THEQUICKBROWN";
      children = "2R220002R0RL0";

      Show the order of the nodes in an in-order traversal of the tree.

  4. (10 points)

    THEQUICKLAZYFOX is the pre-order traversal of a tree (one character per node).

    QIUCEHLAZKFYTXO is the in-order traversal of the same tree.

    What is the order of the nodes in the level-order traversal of this tree?

  5. (5 points) Problem 6.37[6.22]. For this problem, you will write and include code in your submission document. (You do not actually have to do this on a computer, but you may do so if it increases your confidence that your code is correct.) You will (probably) need to refer to the Javadoc documentation of java.util.Map to complete this problem.

For Your Consideration

These problems are for you to think about and convince yourself that you could do them. It would be good practice to actually do them, but you are not required to turn them in.