20,182,305 2019-2020-1 "Object-oriented programming and data structures" experiment eight report

20,182,305 2019-2020-1 "Object-oriented programming and data structures" experiment eight report

课程:《程序设计与数据结构》
班级: 1823
姓名: 孙铭泽
学号:20182305 
实验教师:王志强
实验日期:2019年11月11日
必修/选修: 必修

1. Experimental content

  • Reference materials PP16.1, LinkedBinaryTree complete realization chain tree (getRight, contains, toString, preorder , postorder)
    for their implementation LinkedBinaryTree testing with JUnit or write your own driver class, submit test code run shot, to full-screen, contains its own Student ID information
    under the code pushed to the class code hosting platform

  • Based LinkedBinaryTree, Based on (in order, first order) a unique sequence of two functional configuration㕚tree, such as given in sequence and subsequent HDIBEMJNAFCKGL ABDHIEJMNCFGKL, a tree structure in the drawings
    with their write driver or JUnit classes own implementation of the function test, submit test code run shot, to full-screen, contains its own student number information
    Course under the code pushed to code hosting platform

  • Own design and implement a decision tree
    to submit test code run shot, to full-screen, contains its own student number information
    Course under the code pushed to code hosting platform

  • Enter infix expression, use the tree to convert the infix expression to postfix notation, and output postfix expression and calculations (if not a tree, a normal score. If you use a tree, even though there is a small problem, but also to the discretion out)
    to submit test code run shot, to full-screen, contains its own student number information

2. Experimental procedure and results

3. Experimental problems encountered in the process and settlement process

  • Question 1: The following issues when dealing with the prefix and infix expression evaluation tree

  • Problem 1 Solution: After finishing discovered that my position backwards prefix and infix expression, leading to the prefix should prevail when handling, became subject to infix. Recursive calculation error occurs right and left subtree, the root node as the left and right sides of the contents is not the same amount, resulting in different left and right subtrees of the contents of the array length setting. When placed in a natural error.
  • Question 2: not connected to the sub-tree root node by way of the list.
  • Problems 2 Solution: Change the definition of the way the nodes from node definitions up directly to the left and right subtrees of the root node is connected to the root node is defined at the root node.

Guess you like

Origin www.cnblogs.com/Java-cn/p/11848228.html