资源简介
数据结构课程设计 山东大学版 文件索引 文件索引 B树实现 VC++6.0 附有报告文档

代码片段和文件信息
#include “stdafx.h“
#include
#include
#include
#include “nclass.h“
int levelOfBtree = 0; // 初始化B树的高度
int IOOfDatatxt[2];//记录数据文件的读写次数
int IOOfIndextxt[2];//记录索引文件的读写次数
int root;//根节点所在索引文件的块号
static int level; // 当前访问的节点所处的高度
int Isum=0;//索引文件总块数
int Dsum=0;//数据文件总块数
/*linkque Iflag;//索引文件标示
linkque Dflag;//数据文件标示
*/
btnode* head=0;//指向根节点的指针
static int flag;//插入标记
static int NewTree; //临时节点块号
static int insertKey; //要插入的学号
static int insertAddress;//要插入的学号对应块的地址
extern btnode* iread(int n);//读取索引文件中第n块的节点
extern student* dread(int n);//读取数据文件只中第n块的节点
extern void iwrite(btnode *tint n);//写入节点*t到索引文件第n块
extern void dwrite(student *tint n);//写入节点*t到数据文件第n块
extern int getAddress(linkque &qint m);//取name文件中一块空块号
extern void freeAddress(linkque &qint m);//释放name文件中第n块
//初始化队列
linkque queInit()
{
linkque q;
q.front = (lnode*)malloc(sizeof(lnode));
q.rear = q.front;
q.front->next=NULL;
return q;
}
//清空队列
void queDestroy(linkque &q)
{
while(q.front)
{
q.rear=q.front->next;
free(q.front);
q.front=q.rear;
}
}
//队列的插入
void quEen(linkque &qint e)
{
lnode *p;
p=(lnode*)malloc(sizeof(lnode));
p->num=e;
p->next =NULL;
q.rear->next =p;
q.rear=p;
}
//队列的删除
int queDel(linkque &qint e)
{
lnode *p;
if (q.front==q.rear) return(-1);
p=q.front->next;
e=p->num;
q.front->next=p->next;
if (q.rear==p) q.rear=q.front;
free(p);
return(e);
}
//队列的长度
int queLength(linkque &q)
{
int i=0;
lnode *p;
p=q.front->next;
while (p)
{
++i;
p=p->next;
}
return (i);
}
linkque Iflag=queInit();//索引文件标示
linkque Dflag=queInit();//数据文件标示
//建立一个新的根结点
btnode* NewRoot(btnode* t)
{
btnode* temp;
temp = (btnode*)malloc(sizeof(btnode));
temp->d =1;
temp->p[0] =root;
temp->p[1] = NewTree;
temp->k[0].ID= insertKey;
temp->k[0].address = insertAddress;
levelOfBtree++;
int index=getAddress(IflagIsum);
iwrite(tempindex);
root=index;
delete head;
head=temp;
return head;
}
//在节点中插入索引信息
void InsertInNode(btnode* t int d)
{
int i;
for(i = t->d; i > d; i--)
{
t->k[ i ] = t->k[i-1];
t->p[i+1] = t->p[ i ];
}
t->k[i].ID= insertKey;
t->k[i].address=insertAddress;
t->p[i+1] = NewTree;
t->d++;
}
// 将结点t裂解为两个节点
void SplitNode(btnode* t int dint blocknum)
{
int ij;
btnode* temp;
int temp_ktemp_a1;
temp = (btnode*)malloc(sizeof(btnode));
//插入右边的节点中
if (d > M/2) {
for(i=M-2j=(M-1)/2-1; i>=d; i--j--) {
temp->k[j] = t->k[ i ];
temp->p[j+1] = t->p[i+1];
}
for(i=d-1j=d-M/2-2; j>=0; i--j--) {
temp->k[j] = t->k[ i ];
temp->p[j+1] = t->p[i+1];
}
temp->p[0] = t->p[M/2+1];
temp->k[d
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 11176 2010-03-22 18:04 200800300054\BTree.cpp
文件 5232 2010-03-27 11:18 200800300054\data.txt
文件 13940 2010-03-22 18:04 200800300054\Debug\BTree.obj
文件 61556 2010-03-27 11:13 200800300054\Debug\FileIndex2.exe
文件 210440 2010-03-27 11:13 200800300054\Debug\FileIndex2.ilk
文件 38255 2010-03-08 20:57 200800300054\Debug\FileIndex2.map
文件 9399 2010-03-22 17:30 200800300054\Debug\FileIndex2.obj
文件 5111628 2010-03-22 17:30 200800300054\Debug\FileIndex2.pch
文件 394240 2010-03-27 11:13 200800300054\Debug\FileIndex2.pdb
文件 4024 2010-03-21 20:47 200800300054\Debug\FileIndex2.res
文件 32149 2010-03-27 11:13 200800300054\Debug\FileIndex2Dlg.obj
文件 5938 2010-03-22 17:30 200800300054\Debug\IOcount.obj
文件 832 2010-03-22 17:30 200800300054\Debug\StdAfx.obj
文件 58368 2010-03-27 11:18 200800300054\Debug\vc60.idb
文件 380928 2010-03-07 14:29 200800300054\Debug\vc60.pdb
文件 23904 2010-03-27 10:53 200800300054\FileIndex2.aps
文件 2872 2010-03-27 11:19 200800300054\FileIndex2.clw
文件 2117 2010-03-21 19:37 200800300054\FileIndex2.cpp
文件 4468 2010-03-08 20:58 200800300054\FileIndex2.dsp
文件 528 2010-03-04 22:00 200800300054\FileIndex2.dsw
文件 1368 2010-03-04 22:00 200800300054\FileIndex2.h
文件 271360 2010-03-27 11:19 200800300054\FileIndex2.ncb
文件 50688 2010-03-27 11:19 200800300054\FileIndex2.opt
文件 1237 2010-03-27 11:13 200800300054\FileIndex2.plg
文件 8339 2010-03-21 20:47 200800300054\FileIndex2.rc
文件 13607 2010-03-27 11:13 200800300054\FileIndex2Dlg.cpp
文件 1837 2010-03-11 11:18 200800300054\FileIndex2Dlg.h
文件 2605 2010-03-27 11:18 200800300054\index.txt
文件 24 2010-03-27 11:19 200800300054\initialization.txt
文件 2477 2010-03-10 16:46 200800300054\IOcount.cpp
............此处省略13个文件信息
相关资源
- VC++6.0番茄西红柿VAXvirsual assist X完美破
- VC++6.0 绿色版,免安装,非常好用。
- VC++6.0汉化包
- 车站计算机联锁vc++6.0程序代码
- 成绩管理系统VC++6.0
- VC++6.0技术内幕第五版中文版+英文版
- MFC多人聊天室
- VC++6.0 简体中文版 msdn
- VC++6.0编程实现MIF文件点集读取与凸壳
- Visual Assist X西红柿插件VC++6.0通用安装
- 用vc++6.0实现的银行账户管理系统
- 番茄助手vc++6.0+破解版
- 学生信息管理系统基于VC++6.0
- VC++6.0 MFC AGV绘轨迹
- VC++6.0小番茄助手(绿色版可用)173
- 基于VC MFC的数据分析系统
- VC++6.0 MFC串口编程上位机程序代码.
- VC++6.0多人网络小游戏-支持多人联机网
- 精美时钟VC++6.0源代码)
- vc++6.0 与access管理系统
- 模拟生态系统
- VC++6.0 双人五子棋游戏
- VC++ MFC编写的2048小游戏工程及源代码
- VC++6.0 MFC 基于对话框编写的扫雷源程
- 基于TCP协议VC++6.0实现的聊天程序
- Microsoft vc++6.0代码提示插件
- 遗传算法代码NSGA-II
- 基于VC++6.0的UDP通讯
- VC++6.0番茄西红柿助手VAXvirsual assist
- vc++6.0中文版支持win7
评论
共有 条评论