Data structures and OOP "Experimental Report 8

Science 20182329 No. 2019-2020-1 "Object-oriented programming and data structures" Experimental Report 8

  • Course: "Programming and Data Structures"
  • Class: 1823
  • Name: Li Yizhuo
  • Student ID: 20182329
  • Experiment Teacher: Wang Zhiqiang
  • Experiment Date: October 16, 2019
  • Compulsory / Elective: Compulsory

1. Experimental content

  • According to the structure of its own chain, write a binary tree.
  • Creating NODE structure of the ATD and ATD Link structure to accommodate the establishment of the tree.
  • Learn to use the tree preorder, preorder, postorder, to find, which is built on a tree.
  • Definition and implementation of the decision tree learning methods, reference may be made to establish complete binary tree.
  • Experiment 4 infix expression is used to establish a tree, output postfix expression.

2. Experimental procedure and results

  • 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

  • LinkedBinaryTree, realize the function based on (in order, first order) unique sequences configured based on a two 㕚 tree, such as given in sequence and subsequent HDIBEMJNAFCKGL ABDHIEJMNCFGKL, tree constructed drawings

Performed with JUnit or write your own driver class of functions to achieve their own test, submit test code run shot, to full-screen, contains its own student number information

  • Own design and implement a decision tree
  • Input infix expressions, using the tree to convert the postfix expression is infix and postfix expression and outputs the calculation result

3. Experimental problems encountered in the process and settlement process

  • Question 1: I found my tree can not go down when the establishment of the decision tree, only to be left in the root node.
  • Problem 1 Solution: Later I found that I still use at the time of the establishment of the decision tree is to establish binary tree, use add to create, diagnose should be performed using methods with Scanner input, judgment statement.
  • Question 2: In experiment 3, when you run your own tree and found his class the following error,

And I found all my programs have emerged this error, can not run

  • Question 2 Solution: a long time on the Internet looking for information on all environmental variables, I looked at my command line window java and javac are two 1.7 and can be compiled and run normally. Ruled out the problem java environment, the environment can only be a question of IDEA, the project structure of the project, the first project-specific JDK, then the PATH project, the path is now modify the current project will be in the next path

But this was from a new project, I have tried other methods.

Generated due to the lack of normal main class bytecode files java bytecode file is saved in the project bin folder. Which is your project class bytecode files and resources generated files. If you have the main class bytecode files, and no other bytecode files required classes, no error: Can not find or load the main class xxx, but will display an exception is thrown, can not find a class.

Other (perception, thinking, etc.)

When looking for learning chain, can be found in many ways, not necessarily bubble sort method or a selection made, modulo hashing sorting cycle may be ordered as a number, but must first find sort, then decided to insert or exchange sort, of course, the most simple linear ordering can also exchange, the exchange is the fastest method of quick sort algorithm. Establish tree, they must be ordained his structure, storytelling is a non-linear structure whose elements are organizational hierarchy during the traversal time, must pay attention to the relationship between the number of left and right sub-tree, and the number of construction methods.

Reference material

Guess you like

Origin www.cnblogs.com/lyz182329/p/11875841.html