全文预览

按照算法导论中伪代码转化(共9页)

上传者:科技星球 |  格式:doc  |  页数:9 |  大小:0KB

文档介绍
d;Рint main(void){? BTree<int> t(2);? int i;? cout << "Insert 1 - 9 to B-Tree :" << endl;? for(i = 1; i < 10; i ++){?  t.BTree_Insert(i);?  printf("[%d] ", i);?  t.print_root();? }? putchar('\n');? cout << "Delete 1 - 5 from B-Tree :" << endl;? for(i = 1; i < 6; i ++){?  if(t.BTree_Delete(i)){?   printf("[%d] ", i);?   t.print_root();?  }?  if(t.BTree_Search(3))?   printf("3 is in B-Tree now.\n\n");?  else?   printf("3 is not in B-Tree now.\n\n");? }? putchar('\n');? cout << "Insert 10 - 15 to B-Tree :" << endl;? for(i = 10; i < 16; i ++){?  t.BTree_Insert(i);?  printf("[%d] ", i);?  t.print_root();? }? putchar('\n');? cout << "Delete all from B-Tree :" << endl;? for(i = 6; i < 16; i ++){?  if(t.BTree_Delete(i)){?   printf("[%d] ", i);?   t.print_root();?  }? }? putchar('\n');? return 0;?}

收藏

分享

举报
下载此文档