基本pathyon知识及算法(Basic pathyon knowledge and algorithms).docVIP

  • 129
  • 0
  • 约8.22千字
  • 约 20页
  • 2017-10-06 发布于河南
  • 举报

基本pathyon知识及算法(Basic pathyon knowledge and algorithms).doc

基本pathyon知识及算法(Basic pathyon knowledge and algorithms)

基本pathyon知识及算法(Basic pathyon knowledge and algorithms) Experimental report of Xian Jiao Tong University Course Name: University computer basic experiment Name: tree and graph storage College: College of science ___ ______________________ experimental date Class: _ letter 11_______________ Name: ___ Wang rang _____________ number: 2110902016 1. experimental purposes Learn how to solve problems through computer programs. Understand the sequential storage of trees and graphs in a computer. 2. experiment tasks and requirements (1) write programs to calculate information entropy. Requirement: the user enters the probability of each message element from the keyboard. The input 0 indicates the end of the input data, and the program calculates the information entropy and outputs the information (2) to achieve the storage of two fork tree. Ask yourself to construct a two binary tree, the list stored in the calculation, a user input node value, computing nodes and sub nodes around his father and, if not, then display the message of no. (3) storage of the drawing. To design a plan yourself, you should have at least 5 nodes and 6 sides. Stored in a computer, the user enters the name of the node, and if it is a node in the graph, displays its adjacent contact. 3. experimental tools and methods Operating system: Windows operating system Application software: Python language environment 4. experiment procedure and result (1) I=0 A=float (input (Please, input, a=, probability)) While a! =0:! Import math B=math.log (a, 2) I=I-a*b A=float (input (Please, input, a=, probability)) Print (the entropy is, I) Please input probability a=0.4 Please input probability a=0.22 Please input probability a=0.18 Please input probability a=0.1 Please input probability a=0.06 Please input probability a=0.04 Please input probability a=0 The entropy is 2.2161329359279525 (2) Binarytree=[,A,B,C,D,#,E,F,#,#,G,#, H,I,J] Bsize=13 A=input (enter a letter) If a in binarytree: L=binarytree.index (a) If l==1:

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档