資源簡介
最簡單的B加樹源碼,只實現了添加和刪除、打印操作,方便學習。

代碼片段和文件信息
//?B+Tree.cpp?:?定義控制臺應用程序的入口點。
//
#include?“stdafx.h“
#include?“BPlusTree.h“
int?_tmain(int?argc?_TCHAR*?argv[])
{
BPlusTree?bt;
srand(rand());
for?(int?i?=?1;?i?<=?50;?i++)
{
char?str[256]?=?{?0?};
int?m?=?rand();
sprintf(str?“name%d“?m);
string?strName;
strName?=?str;
bt.Insert(m?strName);
}
for?(int?i?=?0;?i?30;?i++)
{
int?n?=?rand();
bt.Remove(n);
}
printf(“remove?after.\n“);
printf(“print?b+tree:\n“);
bt.PrintlayerTree();
bt.PrintLeaves();
bt.ReversePrintLeaves();
return?0;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-05-23?11:20??B+Tree\
?????目錄???????????0??2018-05-23?11:19??B+Tree\B+Tree\
?????文件?????9699328??2018-05-23?11:18??B+Tree\B+Tree.sdf
?????文件?????????964??2018-05-19?13:59??B+Tree\B+Tree.sln
?????文件?????????593??2018-05-23?11:17??B+Tree\B+Tree\B+Tree.cpp
?????文件????????4638??2018-05-20?19:22??B+Tree\B+Tree\B+Tree.vcxproj
?????文件????????1497??2018-05-19?14:03??B+Tree\B+Tree\B+Tree.vcxproj.filters
?????文件???????19803??2018-05-23?11:05??B+Tree\B+Tree\BPlusTree.cpp
?????文件????????1311??2018-05-22?15:12??B+Tree\B+Tree\BPlusTree.h
?????文件????????1503??2018-05-19?13:59??B+Tree\B+Tree\ReadMe.txt
?????文件?????????212??2018-05-19?13:59??B+Tree\B+Tree\stdafx.cpp
?????文件?????????234??2018-05-19?13:59??B+Tree\B+Tree\stdafx.h
?????文件?????????236??2018-05-19?13:59??B+Tree\B+Tree\targetver.h
評論
共有 條評論