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

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

?? 7.cpp

?? 《數據結構與程序設計》書本所有源代碼!!!!
?? CPP
字號:
/* Program extracts from Chapter 7 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 7.1:typedef int Key;typedef int Record;//  Definition of a Key class:  class Key{    public:      //  Add any constructors and methods for key data.    private:      //  Add declaration of key data members here.  };//  Declare overloaded comparison operators for keys.  bool operator ==(const Key &x, const Key &y);  bool operator > (const Key &x, const Key &y);  bool operator < (const Key &x, const Key &y);  bool operator >=(const Key &x, const Key &y);  bool operator <=(const Key &x, const Key &y);  bool operator !=(const Key &x, const Key &y);//  Definition of a Record class:  class Record{    public:      operator Key(); //  implicit conversion from Record to Key.     //  Add any constructors and methods for Record objects.    private:     //  Add data components.  };// Section 7.2:Error_code sequential_search(const List<Record> &the_list,                             const Key &target, int &position)/*Post: If an entry in the_list has key equal to target, then return      success and the output parameter position locates such an entry      within the list.      Otherwise return not_present and position becomes invalid.*/{   int s = the_list.size();   for (position = 0; position < s; position++) {      Record data;      the_list.retrieve(position, data);      if (data == target) return success;   }   return not_present;}class Key {   int key;public:   static int comparisons;   Key (int x = 0);   int the_key() const;};bool operator ==(const Key &x,const Key &y);bool operator >(const Key &x,const Key &y);bool operator <(const Key &x,const Key &y);bool operator >=(const Key &x,const Key &y);bool operator <=(const Key &x,const Key &y);bool operator !=(const Key &x,const Key &y);bool operator ==(const Key &x, const Key &y){   Key::comparisons++;   return x.the_key() == y.the_key();}int Key::comparisons = 0;typedef Key Record;void test_search(int searches, List<Record> &the_list)/*Pre:  None.Post: The number of key comparisons and CPU time for a      sequential searching function have been calculated.Uses: Methods of the classes List, Random, and Timer,      together with an output function print_out*/{   int list_size = the_list.size();   if (searches <= 0 || list_size < 0) {      cout << " Exiting test: " << endl           << " The number of searches must be positive." << endl           << " The number of list entries must exceed 0." << endl;      return;   }   int i, target, found_at;   Key::comparisons = 0;   Random number;   Timer clock;   for (i = 0; i < searches; i++) {      target = 2 * number.random_integer(0, list_size - 1) + 1;      if (sequential_search(the_list, target, found_at) == not_present)         cout << "Error: Failed to find expected target " << target << endl;   }   print_out("Successful", clock.elapsed_time(), Key::comparisons, searches);   Key::comparisons = 0;   clock.reset();   for (i = 0; i < searches; i++) {      target = 2 * number.random_integer(0, list_size);      if (sequential_search(the_list, target, found_at) == success)         cout << "Error: Found unexpected target " << target              << " at " << found_at << endl;   }   print_out("Unsuccessful", clock.elapsed_time(), Key::comparisons, searches);}// Section 7.3:class Ordered_list:public List<Record>{public:   Ordered_list();   Error_code insert(const Record &data);   Error_code insert(int position, const Record &data);   Error_code replace(int position, const Record &data);};Error_code Ordered_list::insert(const Record &data)/*Post: If the Ordered_list is not full, the function succeeds:      The Record data is inserted into the list, following the      last entry of the list with a strictly lesser key (or in the      first list position if no list element has a lesser key).      Else: the function fails with the diagnostic Error_code overflow.*/{   int s = size();   int position;   for (position = 0; position < s; position++) {      Record list_data;      retrieve(position, list_data);      if (data >= list_data) break;   }   return List<Record>::insert(position, data);}Error_code Ordered_list::insert(int position, const Record &data)/*Post: If the Ordered_list is not full, 0 <= position <= n,      where n is the number of entries in the list,      and the Record data can be inserted at position in the list,      without disturbing the list order, then the function succeeds:      Any entry formerly in position and all later entries have their      position numbers increased by 1 and data is inserted at position      of the List.      Else: the function fails with a diagnostic Error_code.*/{   Record list_data;   if (position > 0) {      retrieve(position - 1, list_data);      if (data < list_data)         return fail;   }   if (position < size()) {      retrieve(position, list_data);      if (data > list_data)         return fail;   }   return List<Record>::insert(position, data);}Error_code recursive_binary_1(const Ordered_list &the_list, const Key &target,                              int bottom, int top, int &position)/*Pre:  The indices bottom to top define the      range in the list to search for the target.Post: If a Record in the range of locations      from bottom to top in the_list has key equal      to target, then position locates      one such entry and a code of success is returned.      Otherwise, the Error_code of not_present is returned      and position becomes undefined.Uses: recursive_binary_1 and methods of the classes List and Record.*/{   Record data;   if (bottom < top) {              // List has more than one entry.      int mid = (bottom + top) / 2;      the_list.retrieve(mid, data);      if (data < target)  // Reduce to top half of list.         return recursive_binary_1(the_list, target, mid + 1, top, position);      else                          // Reduce to bottom half of list.         return recursive_binary_1(the_list, target, bottom, mid, position);   }   else if (top < bottom)      return not_present;           // List is empty.   else {                           // List has exactly one entry.      position = bottom;      the_list.retrieve(bottom, data);      if (data == target) return success;      else return not_present;   }}Error_code run_recursive_binary_1(const Ordered_list &the_list,                                  const Key &target, int &position){  return recursive_binary_1(the_list, target, 0, the_list.size() - 1, position);}Error_code binary_search_1 (const Ordered_list &the_list,                            const Key &target, int &position)/*Post: If a Record in the_list  has Key equal to target, then position locates      one such entry and a code of success is returned.      Otherwise, not_present is returned and position is undefined.Uses: Methods for classes List and Record.*/{   Record data;   int bottom = 0, top = the_list.size() - 1;   while (bottom < top) {      int mid = (bottom + top) / 2;      the_list.retrieve(mid, data);      if (data < target)         bottom = mid + 1;      else         top = mid;   }   if (top < bottom) return not_present;   else {      position = bottom;      the_list.retrieve(bottom, data);      if (data == target) return success;      else return not_present;   }}Error_code recursive_binary_2(const Ordered_list &the_list, const Key &target,                              int bottom, int top, int &position)/*Pre:  The indices bottom to top define the      range in the list to search for the target.Post: If a Record in the range from bottom to top in the_list      has key equal to target, then position locates      one such entry, and a code of success is returned.      Otherwise, not_present is returned, and position is undefined.Uses: recursive_binary_2, together with methods from the classes      Ordered_list and Record.*/{   Record data;   if (bottom <= top) {      int mid = (bottom + top) / 2;      the_list.retrieve(mid, data);      if (data == target) {         position = mid;         return success;      }      else if (data < target)         return recursive_binary_2(the_list, target, mid + 1, top, position);      else         return recursive_binary_2(the_list, target, bottom, mid - 1, position);   }   else return not_present;}Error_code run_recursive_binary_2(const Ordered_list &the_list,                                  const Key &target, int &position){  return recursive_binary_2(the_list, target, 0, the_list.size() - 1, position);}Error_code binary_search_2(const Ordered_list &the_list,                           const Key &target, int &position)/*Post: If a Record in the_list has key equal to target, then position locates      one such entry and a code of success is returned.      Otherwise, not_present is returned and position is undefined.Uses: Methods for classes Ordered_list and Record.*/{   Record data;   int bottom = 0, top = the_list.size() - 1;   while (bottom <= top) {      position = (bottom + top) / 2;      the_list.retrieve(position, data);      if (data == target) return success;      if (data < target) bottom = position + 1;      else top = position - 1;   }   return not_present;}/*************************************************************************/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产在线精品一区二区夜色| 亚洲自拍与偷拍| 717成人午夜免费福利电影| av一本久道久久综合久久鬼色| 韩国三级中文字幕hd久久精品| 国内精品免费在线观看| 极品少妇一区二区三区精品视频| 美腿丝袜在线亚洲一区| 青青青伊人色综合久久| 韩日欧美一区二区三区| 国产精品白丝jk黑袜喷水| 国产电影一区二区三区| 99久久婷婷国产综合精品| 91网站黄www| 91精品蜜臀在线一区尤物| 日韩视频免费直播| 中文字幕乱码一区二区免费| 亚洲少妇最新在线视频| 亚洲成av人片在线| 国内精品国产成人国产三级粉色| 福利一区福利二区| 色激情天天射综合网| 精品污污网站免费看| 日韩欧美黄色影院| 国产精品久久久久久久久久免费看 | 久久精品国产免费| 国产一区二区三区国产| www.激情成人| 制服丝袜在线91| 久久精品亚洲精品国产欧美kt∨| 中文字幕亚洲区| 婷婷综合在线观看| 国产不卡在线播放| 精品视频免费在线| 国产欧美日本一区视频| 午夜精品aaa| 丁香婷婷综合色啪| 6080日韩午夜伦伦午夜伦| 久久久久久久久久久久电影 | 国产三区在线成人av| 伊人婷婷欧美激情| 国内成人免费视频| 欧美三区免费完整视频在线观看| 26uuu成人网一区二区三区| 亚洲欧洲一区二区三区| 免费人成黄页网站在线一区二区| av亚洲精华国产精华| 日韩欧美专区在线| 一区二区不卡在线视频 午夜欧美不卡在 | 5858s免费视频成人| 国产精品久久夜| 蜜桃91丨九色丨蝌蚪91桃色| 在线一区二区三区| 国产精品福利一区二区三区| 九九热在线视频观看这里只有精品| 日本道精品一区二区三区| 久久久www成人免费无遮挡大片| 亚洲高清免费在线| 色偷偷成人一区二区三区91| 欧美国产精品v| 国产精品一区二区黑丝| 日韩欧美123| 麻豆精品一区二区综合av| 欧美网站大全在线观看| 亚洲情趣在线观看| 成人黄色网址在线观看| 欧美极品美女视频| 国产在线精品一区二区夜色| 日韩一区二区在线看| 日韩av午夜在线观看| 欧美丰满嫩嫩电影| 午夜免费久久看| 91福利区一区二区三区| 一区二区三区日本| 91国内精品野花午夜精品| 亚洲视频在线观看一区| 国产91精品一区二区麻豆亚洲| 国产片一区二区三区| 大白屁股一区二区视频| 欧美激情一区在线| www.色精品| 国产精品视频一二三区| 91网上在线视频| 亚洲国产精品久久艾草纯爱| 91精品国产乱| 久久精品72免费观看| 欧美精品一区二区精品网| 国产精华液一区二区三区| 国产无一区二区| 91色|porny| 亚洲午夜羞羞片| 欧美一二三区精品| 国产剧情一区二区| 国产精品久久午夜| 欧美日本国产视频| 韩国中文字幕2020精品| 欧美韩日一区二区三区四区| 在线视频欧美精品| 三级成人在线视频| 国产喂奶挤奶一区二区三区| 色8久久精品久久久久久蜜| 亚洲一区二区三区视频在线播放| 日韩一级视频免费观看在线| 国产成人8x视频一区二区| 中文字幕一区二区在线观看| 欧美性极品少妇| 国产精品主播直播| 国产精品伊人色| 一区二区三区日韩| 91麻豆精品国产无毒不卡在线观看| 午夜精品久久久久久久99樱桃| 91精品国产麻豆| 成人丝袜视频网| 亚洲电影视频在线| 久久久午夜精品| 欧美在线小视频| 国产一区在线视频| 亚洲一级二级在线| 久久伊99综合婷婷久久伊| 日本高清成人免费播放| 蜜臀av性久久久久蜜臀aⅴ四虎| 国产欧美日韩在线看| 欧美一区二区成人6969| 91丨九色丨尤物| 蜜桃传媒麻豆第一区在线观看| 亚洲欧美综合网| 精品不卡在线视频| 欧美日韩午夜在线视频| 成人国产精品免费| 国产成人综合精品三级| 日韩黄色免费电影| 一区二区三区日韩欧美| 日本一区二区高清| 2017欧美狠狠色| 91精品国产一区二区| 99re成人在线| 99久久精品免费看| 国产91精品欧美| 国产精品456露脸| 久久丁香综合五月国产三级网站| 亚洲国产乱码最新视频| 亚洲欧美偷拍卡通变态| 国产精品理论片在线观看| 精品国产免费人成在线观看| 日韩三级精品电影久久久| 欧美日韩久久久| 在线一区二区视频| 欧美四级电影网| 欧美性视频一区二区三区| 在线视频一区二区三| 色老汉一区二区三区| 色婷婷久久久久swag精品 | 欧美电视剧免费全集观看| 91精品福利在线| 色999日韩国产欧美一区二区| 99re热这里只有精品视频| 一本久久综合亚洲鲁鲁五月天| 成人国产视频在线观看| 99久久精品免费| 色婷婷综合在线| 欧美日韩精品欧美日韩精品| 欧美卡1卡2卡| 日韩欧美电影一区| 国产午夜久久久久| 亚洲人成小说网站色在线| 一区二区三区不卡在线观看| 亚洲高清免费视频| 免费观看成人鲁鲁鲁鲁鲁视频| 久久精品国产一区二区三区免费看| 美女视频免费一区| 国产精品一区二区久久精品爱涩 | 欧美日韩国产一级| 欧美一区二区三区在线看| 亚洲精品在线免费观看视频| 国产三级精品在线| 一区二区三区中文字幕在线观看| 天天爽夜夜爽夜夜爽精品视频| 麻豆freexxxx性91精品| 丰满放荡岳乱妇91ww| 欧美在线小视频| 久久亚洲精品国产精品紫薇| 国产精品国产三级国产aⅴ入口 | 亚洲综合色噜噜狠狠| 午夜精品久久久久| 国内精品在线播放| 色综合天天天天做夜夜夜夜做| 欧美日韩综合不卡| 久久久久成人黄色影片| 亚洲一区视频在线| 黄色资源网久久资源365| 一本在线高清不卡dvd| 日韩欧美久久一区| 1024国产精品| 精品亚洲成av人在线观看| 色综合中文综合网| www国产成人| 亚洲一区二区成人在线观看| 一本色道久久综合亚洲91| 日韩欧美色综合网站| 亚洲欧美日韩久久|