【正文】
....................................................................................... 3 第 3 章 詳細(xì)設(shè)計(jì) .................................................................................................................. 4 建立二叉樹 ............................................................................................................. 4 二叉樹的層次遍歷和中序遍歷 ............................................................................. 4 求二叉樹的深度 ..................................................................................................... 7 將二叉樹中所有結(jié)點(diǎn)的左右子樹相互交換 ......................................................... 7 求二叉樹中葉子結(jié)點(diǎn)的數(shù)目 ................................................................................. 9 第 4 章 流程分析圖 ............................................................................................................ 11 流程圖 ................................................................................................................... 11 主要功能模塊設(shè)計(jì) ............................................................................................... 11 模塊設(shè)計(jì) ............................................................................................................... 12 函數(shù)主要調(diào)用關(guān)系圖 ........................................................................................... 13 第 5 章 系統(tǒng)測試 ................................................................................................................ 14 調(diào)試分析 ............................................................................................................... 14 實(shí)驗(yàn)結(jié)果 ............................................................................................................... 15 結(jié) 論 .............................................................................................................................. 17 致 謝 .............................................................................................................................. 18 參考文獻(xiàn) .............................................................................................................................. 18 長春建筑學(xué)院《數(shù)據(jù)結(jié)構(gòu)》課程設(shè)計(jì) (論文) 1 第 1章 緒 論 引言: 樹型結(jié)構(gòu)是一類重要的非線性數(shù)據(jù)結(jié)構(gòu),其中一樹和二叉樹最重要。 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。 in order traversal sequence。 本文對(duì)二叉樹以及二叉樹的各種功能做介紹以及寫出一些基本的程序,讓讀者對(duì)二叉樹的理解有更好的效果。 對(duì)于給幾個(gè)數(shù)據(jù)的排序或在已知的幾個(gè)數(shù)據(jù)中進(jìn)行查找,二叉樹均能提供一種十分有效的方法,比如在查找問題上,任何借助于比較法查找長度為Ⅳ的一個(gè)序表的算法,都可以表示成一株二叉樹。 二叉樹是一種非常重要的非線性結(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),右子樹;后序