亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? 11.cpp

?? 《數據結構與程序設計》書本所有源代碼!!!!
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/* Program extracts from Chapter 11 of   "Data Structures and Program Design in C++"   by Robert L. Kruse and Alexander J. Ryba   Copyright (C) 1999 by Prentice-Hall, Inc.  All rights reserved.   Extracts from this file may be used in the construction of other programs,   but this code will not compile or execute as given here. */// Section 11.2:class Trie {public:  //  Add method prototypes here.private:  //  data members   Trie_node *root;};const int num_chars = 28;struct Trie_node {//    data members   Record *data;   Trie_node *branch[num_chars];//    constructors   Trie_node();};Error_code Trie::trie_search(const Key &target, Record &x) const/*Post: If the search is successful, a code of success is      returned, and the output parameter x is set as a copy      of the Trie's record that holds target.      Otherwise, a code of not_present is returned.Uses: Methods of class Key.*/{   int position = 0;   char next_char;   Trie_node *location = root;   while (location != NULL && (next_char = target.key_letter(position)) != ' ') {         //  Terminate search for a NULL location or a blank in the target.      location = location->branch[alphabetic_order(next_char)];         //  Move down the appropriate branch of the trie.      position++;         //  Move to the next character of the target.   }   if (location != NULL && location->data != NULL) {      x = *(location->data);      return success;   }   else      return not_present;}Error_code Trie::insert(const Record &new_entry)/*Post: If the Key of new_entry is already in the Trie,      a code of duplicate_error is returned.      Otherwise, a code of success is returned and      the Record new_entry is inserted into the Trie.Uses: Methods of classes Record and Trie_node.*/{   Error_code result = success;   if (root == NULL) root = new Trie_node;  //  Create a new empty Trie.   int position = 0;                        //  indexes letters of new_entry   char next_char;   Trie_node *location = root;              //  moves through the Trie   while (location != NULL &&         (next_char = new_entry.key_letter(position)) != ' ') {      int next_position = alphabetic_order(next_char);      if (location->branch[next_position] == NULL)         location->branch[next_position] = new Trie_node;      location = location->branch[next_position];      position++;   }   //  At this point, we have tested for all nonblank characters of new_entry.   if (location->data != NULL) result = duplicate_error;   else location->data = new Record(new_entry);   return result;}// Section 11.3:template <class Record, int order>class B_tree {public:  //  Add public methods.private: //  data members   B_node<Record, order> *root;         //  Add private auxiliary functions here.};template <class Record, int order>struct B_node {//  data members:   int count;   Record data[order - 1];   B_node<Record, order> *branch[order];//  constructor:   B_node();};template <class Record, int order>Error_code B_tree<Record, order>::search_tree(Record &target)/*Post: If there is an entry in the B-tree whose key matches that in target,      the parameter target is replaced by the corresponding Record from      the B-tree and a code of success is returned.  Otherwise      a code of not_present is returned.Uses: recursive_search_tree*/{   return recursive_search_tree(root, target);}template <class Record, int order>Error_code B_tree<Record, order>::recursive_search_tree(           B_node<Record, order> *current, Record &target)/*Pre:  current is either NULL or points to a subtree of the B_tree.Post: If the Key of target is not in the subtree, a code of not_present      is returned. Otherwise, a code of success is returned and      target is set to the corresponding Record of the subtree.Uses: recursive_search_tree recursively and search_node*/{   Error_code result = not_present;   int position;   if (current != NULL) {      result = search_node(current, target, position);      if (result == not_present)         result = recursive_search_tree(current->branch[position], target);      else         target = current->data[position];   }   return result;}template <class Record, int order>Error_code B_tree<Record, order>::search_node(   B_node<Record, order> *current, const Record &target, int &position)/*Pre:  current points to a node of a B_tree.Post: If the Key of target is found in *current, then a code of      success is returned, the parameter position is set to the index      of target, and the corresponding Record is copied to      target.  Otherwise, a code of not_present is returned, and      position is set to the branch index on which to continue the search.Uses: Methods of class Record.*/{   position = 0;   while (position < current->count && target > current->data[position])      position++;         //  Perform a sequential search through the keys.   if (position < current->count && target == current->data[position])      return success;   else      return not_present;}template <class Record, int order>Error_code B_tree<Record, order>::insert(const Record &new_entry)/*Post: If the Key of new_entry is already in the B_tree,      a code of duplicate_error is returned.      Otherwise, a code of success is returned and the Record new_entry      is inserted into the B-tree in such a way that the properties of a B-tree      are preserved.Uses: Methods of struct B_node and the auxiliary function push_down.*/{   Record median;   B_node<Record, order> *right_branch, *new_root;   Error_code result = push_down(root, new_entry, median, right_branch);   if (result == overflow) {  //  The whole tree grows in height.                              //  Make a brand new root for the whole B-tree.      new_root = new B_node<Record, order>;      new_root->count = 1;      new_root->data[0] = median;      new_root->branch[0] = root;      new_root->branch[1] = right_branch;      root = new_root;      result = success;   }   return result;}template <class Record, int order>Error_code B_tree<Record, order>::push_down(                 B_node<Record, order> *current,                 const Record &new_entry,                 Record &median,                 B_node<Record, order> *&right_branch)/*Pre:  current is either NULL or points to a node of a B_tree.Post: If an entry with a Key matching that of new_entry is in the subtree      to which current points, a code of duplicate_error is returned.      Otherwise, new_entry is inserted into the subtree: If this causes the      height of the subtree to grow, a code of overflow is returned, and the      Record median is extracted to be reinserted higher in the B-tree,      together with the subtree right_branch on its right.      If the height does not grow, a code of success is returned.Uses: Functions push_down (called recursively), search_node,      split_node, and push_in.*/{   Error_code result;   int position;   if (current == NULL) { //  Since we cannot insert in an empty tree, the recursion terminates.      median = new_entry;      right_branch = NULL;      result = overflow;   }   else {   //   Search the current node.      if (search_node(current, new_entry, position) == success)         result = duplicate_error;      else {         Record extra_entry;         B_node<Record, order> *extra_branch;         result = push_down(current->branch[position], new_entry,                            extra_entry, extra_branch);         if (result == overflow) {  //  Record extra_entry now must be added to current            if (current->count < order - 1) {               result = success;               push_in(current, extra_entry, extra_branch, position);            }            else split_node(current, extra_entry, extra_branch, position,                            right_branch, median);            //  Record median and its right_branch will go up to a higher node.         }      }   }   return result;}template <class Record, int order>void B_tree<Record, order>::push_in(B_node<Record, order> *current,   const Record &entry, B_node<Record, order> *right_branch, int position)/*Pre:  current points to a node of a B_tree.  The node *current is not full      and entry belongs in *current at index position.Post: entry has been inserted along with its right-hand branch      right_branch into *current at index position.*/{   for (int i = current->count; i > position; i--) {  //  Shift all later data to the right.      current->data[i] = current->data[i - 1];      current->branch[i + 1] = current->branch[i];   }   current->data[position] = entry;   current->branch[position + 1] = right_branch;   current->count++;}template <class Record, int order>void B_tree<Record, order>::split_node(   B_node<Record, order> *current,    //  node to be split   const Record &extra_entry,          //  new entry to insert   B_node<Record, order> *extra_branch,//  subtree on right of extra_entry   int position,                  //  index in node where extra_entry goes   B_node<Record, order> *&right_half, //  new node for right half of entries   Record &median)                     //  median entry (in neither half)/*Pre:  current points to a node of a B_tree.      The node *current is full, but if there were room, the record      extra_entry with its right-hand pointer extra_branch would belong      in *current at position position, 0 <= position < order.Post: The node *current with extra_entry and pointer extra_branch at      position position are divided into nodes *current and *right_half      separated by a Record median.Uses: Methods of struct B_node, function push_in.*/{   right_half = new B_node<Record, order>;   int mid = order/2;  //  The entries from mid on will go to right_half.   if (position <= mid) {   //  First case:  extra_entry belongs in left half.      for (int i = mid; i < order - 1; i++) {  //  Move entries to right_half.         right_half->data[i - mid] = current->data[i];         right_half->branch[i + 1 - mid] = current->branch[i + 1];      }      current->count = mid;      right_half->count = order - 1 - mid;      push_in(current, extra_entry, extra_branch, position);   }   else {  //  Second case:  extra_entry belongs in right half.      mid++;      //  Temporarily leave the median in left half.      for (int i = mid; i < order - 1; i++) {  //  Move entries to right_half.         right_half->data[i - mid] = current->data[i];         right_half->branch[i + 1 - mid] = current->branch[i + 1];      }      current->count = mid;      right_half->count = order - 1 - mid;      push_in(right_half, extra_entry, extra_branch, position - mid);   }      median = current->data[current->count - 1]; //  Remove median from left half.      right_half->branch[0] = current->branch[current->count];      current->count--;}template <class Record, int order>Error_code B_tree<Record, order>::remove(const Record &target)/*Post: If a Record with Key matching that of target belongs to the      B_tree, a code of success is returned and the corresponding node      is removed from the B-tree.  Otherwise, a code of not_present      is returned.Uses: Function recursive_remove*/{   Error_code result;   result = recursive_remove(root, target);   if (root != NULL && root->count == 0) {  //  root is now empty.      B_node<Record, order> *old_root = root;      root = root->branch[0];      delete old_root;   }   return result;}template <class Record, int order>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆国产精品一区二区三区| 欧美三级电影在线看| 色噜噜狠狠成人网p站| 555夜色666亚洲国产免| 国产精品亲子伦对白| 久久99九九99精品| 欧美午夜片在线看| 国产精品欧美久久久久无广告 | 午夜久久久久久久久| 国产成人综合精品三级| 制服丝袜成人动漫| 一区二区三区精品久久久| 国产美女精品人人做人人爽| 欧美久久久久久久久中文字幕| 亚洲天堂中文字幕| 成人动漫一区二区三区| 精品理论电影在线| 久久精品噜噜噜成人av农村| 7777精品久久久大香线蕉| 亚洲h精品动漫在线观看| 99久免费精品视频在线观看| 久久人人爽爽爽人久久久| 激情六月婷婷久久| 精品粉嫩aⅴ一区二区三区四区| 日日骚欧美日韩| 欧美色精品在线视频| 亚洲午夜久久久久中文字幕久| 色婷婷久久久综合中文字幕 | 不卡av免费在线观看| 2021中文字幕一区亚洲| 久久99精品国产麻豆不卡| 欧美一级欧美一级在线播放| 天天操天天干天天综合网| 欧美午夜电影网| 日韩高清欧美激情| 日韩写真欧美这视频| 狠狠色丁香婷婷综合久久片| 久久久亚洲国产美女国产盗摄| 久久综合综合久久综合| 久久午夜国产精品| 成人午夜碰碰视频| 亚洲情趣在线观看| 欧美色区777第一页| 日韩国产欧美在线观看| 91精品国产aⅴ一区二区| 美美哒免费高清在线观看视频一区二区 | 色婷婷综合久久久久中文| 亚洲精品免费看| 欧美日韩国产中文| 久久精品国产亚洲高清剧情介绍 | 青青草伊人久久| 日韩欧美一级二级三级| 国产又黄又大久久| 国产精品大尺度| 欧美日韩国产免费一区二区| 美女视频黄久久| 国产精品每日更新在线播放网址 | 国产99久久精品| 一二三区精品视频| 欧美成人a视频| aaa亚洲精品一二三区| 亚洲成人综合网站| 国产一区二区在线电影| 欧日韩精品视频| 乱一区二区av| ...av二区三区久久精品| 欧美日韩国产综合一区二区| 国内精品视频一区二区三区八戒| 中文幕一区二区三区久久蜜桃| 欧美在线一区二区三区| 精品亚洲国产成人av制服丝袜| 亚洲天堂2014| 日韩一区二区三区电影| 91在线无精精品入口| 美腿丝袜一区二区三区| 亚洲日本青草视频在线怡红院| 欧美一级片在线看| 色久综合一二码| 国产99久久久国产精品潘金网站| 亚洲高清免费观看| 国产精品久久久久精k8| 精品国免费一区二区三区| 在线观看一区不卡| caoporn国产精品| 精品一区二区三区日韩| 午夜精品久久久久久久99水蜜桃| 国产精品三级电影| 2023国产精华国产精品| 宅男在线国产精品| 在线一区二区三区做爰视频网站| 国产河南妇女毛片精品久久久| 日本伊人色综合网| 亚洲制服丝袜av| 亚洲精选免费视频| 国产精品免费视频一区| 26uuu精品一区二区| 欧美精品久久久久久久多人混战 | 热久久久久久久| 亚洲国产一二三| 亚洲在线观看免费视频| 综合久久国产九一剧情麻豆| 欧美激情综合网| 国产农村妇女精品| 26uuu精品一区二区| 欧美va在线播放| 欧美tickling网站挠脚心| 91精选在线观看| 欧美另类高清zo欧美| 欧美日本一区二区| 欧美日本视频在线| 欧美美女黄视频| 欧美电影一区二区三区| 制服丝袜一区二区三区| 在线综合视频播放| 日韩女优毛片在线| 2021久久国产精品不只是精品| 精品国产免费一区二区三区四区 | 北岛玲一区二区三区四区| 国产91精品一区二区麻豆亚洲| 丰满少妇久久久久久久| 成人国产免费视频| 色综合 综合色| 欧美日韩国产片| 日韩一级片网站| 久久久久久久久蜜桃| 国产午夜精品久久久久久久| 国产精品私人影院| 亚洲欧美另类图片小说| 亚洲国产视频一区二区| 青草国产精品久久久久久| 国产在线视频不卡二| 国产**成人网毛片九色| 一本一道久久a久久精品| 欧美视频中文字幕| 3d动漫精品啪啪1区2区免费 | 精品国产乱码久久久久久影片| 欧美精品一区视频| 中文字幕一区二区三区四区| 夜夜精品浪潮av一区二区三区| 日韩综合在线视频| 美女视频一区在线观看| 成人深夜在线观看| 欧美日韩精品一区二区三区蜜桃 | 日韩成人免费电影| 国产福利一区二区三区| 色一情一伦一子一伦一区| 日韩一区二区免费视频| 国产精品天干天干在线综合| 亚洲成人动漫在线观看| 国产精品一区二区视频| 色婷婷综合久久久久中文 | 日韩一区二区电影| 国产精品视频一二| 日韩电影在线免费观看| 国产iv一区二区三区| 欧美美女直播网站| 国产精品久久久久久妇女6080| 日韩电影一区二区三区四区| 国产黄色成人av| 777亚洲妇女| 亚洲欧美色一区| 国产一区二区三区电影在线观看| 欧美在线free| 欧美激情在线一区二区| 日韩国产在线一| 91麻豆swag| 国产偷国产偷亚洲高清人白洁 | 欧美变态口味重另类| 亚洲欧美成人一区二区三区| 国产伦精品一区二区三区免费迷 | 3751色影院一区二区三区| 中文字幕一区二区三区不卡| 久久99久久久欧美国产| 欧美日韩一区二区在线观看| 中文字幕亚洲电影| 国产成人av一区| 日韩免费一区二区| 婷婷亚洲久悠悠色悠在线播放| 91网站视频在线观看| 久久精品一区二区三区不卡牛牛 | 日本aⅴ免费视频一区二区三区| 成人手机电影网| 国产日韩欧美精品在线| 久热成人在线视频| 欧美一区二区视频免费观看| 亚洲美女屁股眼交3| 99精品在线免费| 国产精品久久久久永久免费观看 | 在线看日韩精品电影| 亚洲国产成人午夜在线一区| 精品无人码麻豆乱码1区2区 | 成人精品免费网站| 日本一区免费视频| 国产成人自拍高清视频在线免费播放| 精品免费99久久| 国产一区二区三区免费看 | 成人黄色综合网站| 亚洲国产精品av| 成人91在线观看| 亚洲免费在线观看|