構造哈夫曼樹 哈弗曼樹中沒有度為一的節點,是標準的二叉樹,所以有n個葉子結點時,需要一個長度為2n-1的一維數組存儲哈弗曼樹的結點。 (1)、n個葉子節點只有weight權值,處理非葉子節點,從ht[i](ht[1]~ht[n-1])中找到ht[i].weight最小的兩個節點ht[s1]和ht[s2],這就是Select(INT n,INT &s1,INT & s2,HTNode *ht)函數完成的功能。 (2)、調用select函數,并將ht[s1]和ht[s2]作為ht[l]的左右子樹,即ht[s1]和ht[s2]雙親節點為ht[l],新的根節點的權值為其左右子樹權值之和, ht[l].weight=ht[s1].weight+ht[s2].weight
上傳時間: 2016-06-13
上傳用戶:ztj182002
這是在學習數據庫時寫的一個程序,采取DAO訪問ACCESS數據庫的方式 1:在程序中使用了CButtonStyle這個免費類庫。 2:在InitButtonSytle()中,為了使代碼更短小,用循環實現了位圖按鈕。 // 用循環實現必須手動改動Resource.h中的定義 // 具體細節請參看源代碼 for ( INT nIco = IDI_JUMP, nBtn = IDC_JUMP nBtn >= IDC_LISTITEM nIco--, nBtn-- ) { CButtonStyle *Button = ButtonList.RemoveTail() Button->SubclassDlgItem( nBtn, this ) Button->SetIcon( nIco ) Button->SetInactiveBgColor() Button->SetInactiveFgColor() Button->SetActiveBgColor() }
上傳時間: 2013-12-24
上傳用戶:moshushi0009
fft源代碼,#include "f2407_c.h" #include "math.h" #define N 32 // FFT變換的點數 extern void fft(void); extern void resave(void); INTerrupt void phantom(void); void sysinit(void); extern INT input[2*N];
上傳時間: 2016-06-28
上傳用戶:LouieWu
復數運算#include<iostream.h> class Complex { public: Complex( double r =0, double i =0 ) Complex(INT a) { Real = a Image = 0 } void prINT() const friend Complex operator+ ( const Complex & c1, const Complex & c2 ) friend Complex operator- ( const Complex & c1, const Complex & c2 ) friend Complex operator- ( const Complex & c ) private: double Real, Image }
標簽: Complex double iostream include
上傳時間: 2016-06-30
上傳用戶:wang5829
AutomaticPropertiesDefaultValues Article_src.zip PropertyInfo[] props = o.GetType().GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static) for (INT i = 0 i < props.Length i++) { PropertyInfo prop = props[i] if (prop.GetCustomAttributes(true).Length > 0) { object[] defaultValueAttribute = prop.GetCustomAttributes(typeof(DefaultValueAttribute), true) if (defaultValueAttribute != null) { DefaultValueAttribute dva = defaultValueAttribute[0] as DefaultValueAttribute if(dva != null) prop.SetValue(o, dva.Value, null) }
標簽: AutomaticPropertiesDefaultValues PropertyInfo Article_src GetPropert
上傳時間: 2014-11-22
上傳用戶:xaijhqx
我所采用的內存管理思想是鏈表管理思想,內存分配方案是最佳適應方案(best fit)。其主要的數據結構為 struct node { char* p INT memosize INT flag struct node* next } 這是一個鏈表的結點的數據結構,用它來管理內存的分配與回收。P 表示所指的分配的內存的首地址,memosize 表示分配的內存塊的大小,flag 為一個標志量,表示內存塊是否被占用。用 1 和 0 來表示被占用和不被占用。next 表示下一個結點的首地址。 內存管理包括一個分配內存的mm_request(unsigned INT)函數,一個初始化所要管理的內存的mm_init()函數,一個空閑列表排序函數sort(),一個釋放內存的mm_release(void* )函數和一個判斷內存是否被占用的IsFree(INT)函數。
標簽: 內存管理
上傳時間: 2016-07-06
上傳用戶:qunquan
package query public class LinkQuery { private Node front private Node vear public LinkQuery() { this.front=null this.vear=null } public void add(INT i) { Node newNode=new Node(i) if(vear==null && front==null) { vear=newNode front=newNode return } vear.next=newNode vear=newNode } public INT remove() { if(this.front==null) { System.out.prINTln("隊是空的,無法取") return -1 } INT temp=this.front.data this.front=this.front.next if(this.front==null) { this.vear=null }
標簽: private public Node LinkQuery
上傳時間: 2016-07-08
上傳用戶:天誠24
密碼算法程序包miracl contains all the source code for the latest version of MIRACL: a Multiprecision INTeger and Rational Arithmetic C/C++ library.
標簽: Multiprecision the contains version
上傳時間: 2016-07-08
上傳用戶:xinyuzhiqiwuwu
c++二、通過將其元素插入到雙向鏈表中的方法對數組A進行排序。算法對鏈表的當前操作位置進行維護,當需要插入表項時,若新元素比當前位置值要大,則往前移動;若小則往后移動。編寫函數DoubleSort實現上述排序算法。 template <class T> void DoubliSort( T a[], INT n)
上傳時間: 2013-12-03
上傳用戶:gundamwzc
二、通過將其元素插入到雙向鏈表中的方法對數組A進行排序。算法對鏈表的當前操作位置進行維護,當需要插入表項時,若新元素比當前位置值要大,則往前移動;若小則往后移動。編寫函數DoubleSort實現上述排序算法。 template <class T> void DoubliSort( T a[], INT n)
上傳時間: 2016-07-15
上傳用戶:遠遠ssad