【正文】
長(zhǎng)春建筑學(xué)院《數(shù)據(jù)結(jié)構(gòu)》課程設(shè)計(jì)(論文) 基于二叉樹遍歷系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn) Binary tree traversal System Design and Implementation 年 級(jí) : 學(xué) 號(hào) : 姓 名 : 專 業(yè) : 指導(dǎo)老師 : 二零一三年十二月長(zhǎng)春建筑學(xué)院《數(shù)據(jù) 結(jié)構(gòu)》課程設(shè)計(jì) (論文) I 摘 要 針對(duì)現(xiàn)實(shí)世界中許多關(guān)系復(fù)雜的數(shù)據(jù),如人類社會(huì)的家譜,各種社會(huì)組織機(jī)構(gòu) ,博弈交通等復(fù)雜事物或 過程以及客觀世界中廣泛存在的具有分支關(guān)系或?qū)哟翁匦缘膶?duì)象.如操作系統(tǒng)的文件構(gòu)成、人工智能和算法分析的模型表示以及數(shù)據(jù)庫(kù)系統(tǒng)的信息組織形式等,用線性結(jié)構(gòu)難以把其中的邏輯關(guān)系表達(dá)出來,必須借助于數(shù)和圖這樣的非線性結(jié)構(gòu),因此在以模擬客觀世界問題,解決客觀世界問題為主要任務(wù)的計(jì)算機(jī)領(lǐng)域中樹型結(jié)構(gòu)是信息的一種重要組織形式,樹有著廣泛應(yīng)用。在樹型結(jié)構(gòu)的應(yīng)用中又以二叉樹最為常用。 二叉樹是一種非常重要的非線性結(jié)構(gòu),所描述的數(shù)據(jù)有明顯的層次關(guān)系,其中的每個(gè)元素只有一個(gè)前驅(qū),二叉樹是最為常用的數(shù)據(jù)結(jié)構(gòu),它的實(shí)際應(yīng)用非常廣泛, 二叉樹的遍歷方式有三種,前序遍歷,中序遍歷,后序遍歷,先序遍歷的順序?yàn)椋?NLR先根結(jié)點(diǎn),然后左子樹,右子樹;中序遍歷順序?yàn)椋?LNR 先左子樹,然后根結(jié)點(diǎn),右子樹;后序遍歷順序?yàn)椋?LRN 先左子樹,然后右子樹,根結(jié)點(diǎn)。由前序和中序遍歷,有中序和后序遍歷序列可以唯一確定一棵二叉樹。 對(duì)于給幾個(gè)數(shù)據(jù)的排序或在已知的幾個(gè)數(shù)據(jù)中進(jìn)行查找,二叉樹均能提供一種十分有效的方法,比如在查找問題上,任何借助于比較法查找長(zhǎng)度為Ⅳ的一個(gè)序表的算法,都可以表示成一株二叉樹。反之,任何二叉樹都對(duì)應(yīng)一個(gè)查找有序表的有效方法根據(jù)樹的數(shù)學(xué)理論, 對(duì)于算法分析的某些最有啟發(fā)性的應(yīng)用,是與給出用于計(jì)算各種類型中不同樹的數(shù)目的公式有關(guān)的。 本文對(duì)二叉樹以及二叉樹的各種功能做介紹以及寫出一些基本的程序,讓讀者對(duì)二叉樹的理解有更好的效果。 關(guān)鍵詞 :二叉樹; 左子樹; 右子樹長(zhǎng)春建筑學(xué)院《數(shù)據(jù)結(jié)構(gòu)》課程設(shè)計(jì) (論文) II Abstract In many real world of plex data, such as the human society family, social anization, widespread game traffic plex thing or process and the objective world with a branch or level characteristics of the object. If the operating system file analysis, artificial intelligence and algorithm model representation and database information system the form of anization, with a linear structure to express the logic relationship among them, must depend on the number and the diagram of such nonlinear structure, so in order to simulate the objective world, solve problems as the main task of the puter field in the tree structure is an important anization form of information, the tree has a broad application. In the application of tree structure in which the two fork tree is the most monly used. Two binary tree is a kind of very important nonlinear structure, hiberarchy description of the data, where each element is only a precursor, two fork tree is the most monly used data structure, its application is very extensive, there are three kinds of two binary tree traversal, preorder traversal, in the traversal, postorder traversal, preorder traversal sequence: NLR to the root node, and then the left subtree, right subtree。 in order traversal sequence。 LNR before the left sub tree, then the root node, the right subtree。 after the traversal order: LRN first and then the left subtree, right subtree, root node. By preorder traversal and traversal, with the order and post order traversal sequence can be uniquely identified a two binary tree. For several data sorting or searching in several data known, two fork tree can provide a very effective method, such as search problems, any by the parison method to find the length of a sequential algorithm of Table IV, can be expressed as a two fork tree. Conversely, any two fork tree corresponds to an effective method to find the ordered list according to the mathematical theory of tree, for some algorithm analysis of the application of heuristic, is given for the number and different types of tree calculation formula. Various functions of two binary tree and binary tree in this paper two introduces and write some of the basic procedures, to allow readers to understand the two fork tree has a better effect. Keywords:Two tree。 the left subtree。 right subtree 長(zhǎng)春建筑學(xué)院《數(shù)據(jù)結(jié)構(gòu)》課程設(shè)計(jì) (論文) 目 錄 摘 要 .......................................................