1.[問題描述] 編寫遞歸算法,計算二叉樹中葉子結點的數目 [輸入] 按照先序序列的順序輸入該結點的內容。其輸入abd eh cf i g . [輸出] 按中序序列輸出,輸出的結果為;dbheaficg并計算出二叉樹中葉子結點的數目為4 [存儲結構] 采用二叉表存儲 [算法的基本思想] 采用遞歸方法建立和遍歷二叉樹。首先建立二叉樹的根結點,然后建立其左右子樹,直到空子樹為止,中序遍歷二叉樹時,先遍厲左子樹,后遍厲右子樹,最后訪問根結點。根據左右子樹的最后一個結點計算出二叉樹中葉子結點的數目。 程序如下: #include<stdio.h> #include<malloc.h> #include"stdlib.h"
上傳時間: 2015-11-16
上傳用戶:GavinNeko
2.[問題描述] 編寫遞歸算法,在二叉樹中求位于先序序列中第K個位置的結點 [輸入] 按照先序序列的順序輸入該結點的內容。其輸入abd eh cf i g 。輸入要求的位置 [輸出] 若二叉樹不空,按先序序列輸出,求出所求位置的結點 [存儲結構] 采用二叉表存儲 [算法的基本思想] 采用遞歸方法建立和遍歷二叉樹。首先建立二叉樹的根結點,然后建立其左右子樹,直到空子樹為止,先序遍歷二叉樹時,先遍厲左子樹,后遍厲右子樹,最后訪問根結點并計算出二叉樹中葉子結點的數目和第K個位置的結點 #include<stdio.h> #include<malloc.h> struct node{ char info struct node*llink,*rlink } typedef struct node NODE
上傳時間: 2014-01-13
上傳用戶:zm7516678
[問題描述] 將N個關鍵字去整數的記錄進行整序, 以使所有關鍵字為非負數的記錄排在關鍵字為負數的記錄之前,要求使用最少的附加空間,且算法的時間復雜度為O(N) [輸入] 待排序記錄個數,各關鍵字的值。 [輸出] 關鍵字從正負分開,正數在前 [存儲結構] 待排序記錄順序存儲。 [算法的基本思想] 快速排序算法每次任取一個記錄的關鍵字為標準,將其余記錄分為兩組將,N個關鍵字去整數的記錄進行整序, 以使所有關鍵字為非負數的記錄排在關鍵字為負數的記錄之前。 #include <iostream> using namespace std #define MAXNUM 100//設文件的最長可能長度 void sort(int* keys, const int len)//排序
上傳時間: 2014-01-13
上傳用戶:aig85
Software Testing, Second Edition provides practical insight into the world of software testing and quality assurance. Learn how to find problems in any computer program, how to plan an effective test approach and how to tell when software is ready for release. Updated from the previous edition in 2000 to include a chapter that specifically deals with testing software for security bugs, the processes and techniques used throughout the book are timeless. This book is an excellent investment if you want to better understand what your Software Test team does or you want to write better software.
標簽: practical Software provides software
上傳時間: 2014-08-01
上傳用戶:zhaiyanzhong
The ability to write efficient, high-speed arithmetic routines ultimately depends upon your knowledge of the elements of arithmetic as they exist on a computer. That conclusion and this book are the result of a long and frustrating search for information on writing arithmetic routines for real-time embedded systems. With instruction cycle times coming down and clock rates going up, it would seem that speed is not a problem in writing fast routines. In addition, math coprocessors are becoming more popular and less expensive than ever before and are readily available. These factors make arithmetic easier and faster to use and implement. However, for many of you the systems that you are working on do not include the latest chips or the faster processors. Some of the most widely used microcontrollers used today are not Digital Signal Processors (DSP), but simple eight-bit controllers such as the Intel 8051 or 8048 microprocessors.
標簽: arithmetic high-speed ultimately efficient
上傳時間: 2014-11-30
上傳用戶:lizhen9880
this is μC_OS-Ⅱchinese for arm7 operation,include some useful code
標簽: operation chinese this C_OS
上傳時間: 2015-11-25
上傳用戶:klin3139
/// ////單端輸入,定時啟動,由T2定時,選擇AIN0.3為ADC0轉化通道//////////////// //////single.c/////////////////////////////////// #include "lcd.h"http://筆者所寫的LCD顯示頭文件,具體見LCD章節 /*若讀者沒有條件使用"lcd.h"的各顯示和鍵盤函數,則可在lcd.h文件中如下定義:
上傳時間: 2015-11-26
上傳用戶:vodssv
ApMl provides users with the ability to crawl the web and download pages to their computer in a directory structure suitable for a Machine Learning system to both train itself and classify new documents. Classification Algorithms include Naive Bayes, KNN
標簽: the provides computer download
上傳時間: 2015-11-29
上傳用戶:ywqaxiwang
此程序用來分離一個字符串中的數字及字符,string.zip
上傳時間: 2015-12-02
上傳用戶:wab1981
--- --- --- --- --- --- --- --- --- --- --- --- --- Filename : HP_SENSOR-9.ASM() Remark : --- --- --- --- --- --- --- --- --- --- --- --- --- #include HT82M99E.INC #include USBFIFO.INC #include HP_SENSOR.INC ------------------------------------------------------------------------------ #define CF C #define ZF Z
標簽: HP_SENSOR Filename Remark ASM
上傳時間: 2015-12-05
上傳用戶:jjj0202