91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

數據結構課程設計 山東大學版 文件索引 文件索引 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個文件信息

評論

共有 條評論