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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? 9.cpp

?? 《數(shù)據(jù)結(jié)構(gòu)與程序設(shè)計(jì)》書本所有源代碼!!!!
?? CPP
字號(hào):
/* Program extracts from Chapter 9 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 9.5:template <class Record>class Sortable_list: public List<Record> {public:   //   sorting methods   void radix_sort();   //   Specify any other sorting methods here.private:  //   auxiliary functions   void rethread(Queue queues[]);};class Record {public:   char key_letter(int position) const;   Record();                    //  default constructor   operator Key() const;        //  cast to Key//   Add other methods and data members for the class.};const int max_chars = 28;template <class Record>void Sortable_list<Record>::radix_sort()/*Post: The entries of the Sortable_list have been sorted      so all their keys are in alphabetical order.Uses: Methods from classes List, Queue, and Record;      functions position and rethread.*/{   Record data;   Queue queues[max_chars];   for (int position = key_size - 1; position >= 0; position--) {      //   Loop from the least to the most significant position.      while (remove(0, data) == success) {         int queue_number = alphabetic_order(data.key_letter(position));         queues[queue_number].append(data);    //   Queue operation.      }      rethread(queues);                        //   Reassemble the list.   }}int alphabetic_order(char c)/*Post: The function returns the alphabetic position of character c,      or it returns 0 if the character is blank.*/{   if (c == ' ') return 0;   if ('a' <= c && c <= 'z') return c - 'a' + 1;   if ('A' <= c && c <= 'Z') return c - 'A' + 1;   return 27;}template <class Record>void Sortable_list<Record>::rethread(Queue queues[])/*Post: All the queues are combined back to the Sortable_list, leaving      all the queues empty.Uses: Methods of classes List and Queue.*/{   Record data;   for (int i = 0; i < max_chars; i++)      while (!queues[i].empty()) {         queues[i].retrieve(data);         insert(size(), data);         queues[i].serve();      }}// Section 9.6:class Key: public String{public:    char key_letter(int position) const;    void make_blank();    //  Add constructors and other methods.};int hash(const Key &target)/*Post: target has been hashed, returning a value between 0 and hash_size-1.Uses: Methods for the class Key.*/{   int value = 0;   for (int position = 0; position < 8; position++)      value = 4 * value + target.key_letter(position);   return value % hash_size;}const int hash_size = 997;   //  a prime number of appropriate sizeclass Hash_table {public:   Hash_table();   void clear();   Error_code insert(const Record &new_entry);   Error_code retrieve(const Key &target, Record &found) const;private:   Record table[hash_size];};Error_code Hash_table::insert(const Record &new_entry)/*Post: If the Hash_table is full, a code of overflow is returned.      If the table already contains an item with the key of new_entry      a code of duplicate_error is returned.  Otherwise: The Record new_entry      is inserted into the Hash_table and success is returned.Uses: Methods for classes Key and Record, the function hash.*/{   Error_code result = success;   int probe_count,           //  Counter to be sure that table is not full.       increment,             //  Increment used for quadratic probing.       probe;                 //  Position currently probed in the hash table.   Key null;                   //  Null key for comparison purposes.   null.make_blank();   probe = hash(new_entry);   probe_count = 0;   increment = 1;   while (table[probe] != null              //   Is the location empty?     && table[probe] != new_entry           //   Duplicate key?     && probe_count < (hash_size + 1) / 2) {//   Has overflow occurred?      probe_count++;      probe = (probe + increment) % hash_size;      increment += 2;                  //     Prepare increment for next iteration.   }   if (table[probe] == null) table[probe] = new_entry; //   Insert new entry.   else if (table[probe] == new_entry) result = duplicate_error;   else result =  overflow;                                   //   The table is full.   return result;}class Hash_table {public:   //  Specify methods here.private:   List<Record> table[hash_size];};// Section 9.9:class Life {public:   //  methodsprivate:   bool map[int][int];   //  other data and auxiliary functions};int main()  //  Program to play Conway's game of Life./*Pre:The user supplies an initial configuration of living cells.Post: The program prints a sequence of pictures showing the changes in      the configuration of living cells according to the rules for      the game of Life.Uses: The class Life and its methods initialize(), print() and update().      The functions  instructions(),  user_says_yes().*/{   Life configuration;   instructions();   configuration.initialize();   configuration.print();   cout << "Continue viewing new generations? " << endl;   while (user_says_yes()) {      configuration.update();      configuration.print();      cout << "Continue viewing new generations? " << endl;   }}struct Cell {   Cell() { row = col = 0; }   //  constructors   Cell(int x, int y) { row = x;  col = y; }   int row, col;               //   grid coordinates};class Hash_table {public:   Error_code insert(Cell *new_entry);   bool retrieve(int row, int col) const;private:   List<Cell *> table[hash_size];};class Life {public:   Life();   void initialize();   void print();   void update();   ~Life();private:   List<Cell *> *living;   Hash_table *is_living;   bool retrieve(int row, int col) const;   Error_code insert(int row, int col);   int neighbor_count(int row, int col) const;};void Life::update()/*Post: The Life object contains the next generation of configuration.Uses: The class Hash_table and the class Life and its auxiliary functions.*/{   Life new_configuration;   Cell *old_cell;   for (int i = 0; i < living->size(); i++) {      living->retrieve(i, old_cell);      //  Obtain a living cell.      for (int row_add = -1; row_add < 2; row_add ++)         for (int col_add = -1; col_add < 2; col_add++) {            int new_row = old_cell->row + row_add,                new_col = old_cell->col + col_add;//  new_row, new_col is now a living cell or a neighbor of a living cell,            if (!new_configuration.retrieve(new_row, new_col))               switch (neighbor_count(new_row, new_col)) {               case 3:  //  With neighbor count 3, the cell becomes alive.                  new_configuration.insert(new_row, new_col);                  break;               case 2:  //  With count 2, cell keeps the same status.                  if (retrieve(new_row, new_col))                     new_configuration.insert(new_row, new_col);                  break;               default: //  Otherwise, the cell is dead.                  break;               }         }   }//  Exchange data of current configuration with data of new_configuration.   List<Cell *> *temp_list = living;   living = new_configuration.living;   new_configuration.living = temp_list;   Hash_table *temp_hash = is_living;   is_living = new_configuration.is_living;   new_configuration.is_living = temp_hash;}void Life::print()/*Post: A central window onto the Life object is displayed.Uses: The auxiliary function Life::retrieve.*/{   int row, col;   cout << endl << "The current Life configuration is:" << endl;   for (row = 0; row < 20; row++) {      for (col = 0; col < 80; col++)         if (retrieve(row, col)) cout << '*';         else cout << ' ';      cout << endl;   }   cout << endl;}Error_code Life::insert(int row, int col)/*Pre:  The cell with coordinates row and col does not      belong to the Life configuration.Post: The cell has been added to the configuration.  If insertion into      either the List or the Hash_table fails, an error      code is returned.Uses: The class List, the class Hash_table, and the struct Cell*/{   Error_code outcome;   Cell *new_cell = new Cell(row, col);   int index = living->size();   outcome = living->insert(index, new_cell);   if (outcome == success)      outcome = is_living->insert(new_cell);   if (outcome != success)      cout << " Warning: new Cell insertion failed" << endl;   return outcome;}Life::Life()/*Post: The members of a Life object are dynamically allocated and initialized.Uses: The class Hash_table and the class List.*/{   living = new List<Cell *>;   is_living = new Hash_table;}Life::~Life()/*Post: The dynamically allocated members of a Life object      and all ell objects that they reference are deleted.Uses: The class Hash_table and the class List.*/{   Cell *old_cell;   for (int i = 0; i < living->size(); i++) {      living->retrieve(i, old_cell);      delete old_cell;   }   delete is_living;         //  Calls the Hash_table destructor   delete living;            //  Calls the List destructor}const int factor = 101;int hash(int row, int col)/*Post: The function returns the hashed valued between      0 and hash_size - 1 that corresponds to the given Cell parameter.*/{   int value;   value = row + factor * col;   value %= hash_size;   if (value < 0) return value + hash_size;   else return value;}/*************************************************************************/

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一区二区视频在线观看| 欧美日韩免费高清一区色橹橹 | 3atv一区二区三区| 日本成人在线一区| 欧美激情中文不卡| 欧美午夜免费电影| 国产资源精品在线观看| 国产精品久久精品日日| 欧美性色aⅴ视频一区日韩精品| 蜜桃视频在线观看一区二区| 中文字幕日本乱码精品影院| 欧美日本不卡视频| 成人av集中营| 欧美aaaaaa午夜精品| 国产免费久久精品| 欧美一区二区三区视频免费播放| 成人午夜激情在线| 日韩成人免费看| 中文字幕综合网| 久久久91精品国产一区二区三区| 在线视频国内一区二区| 国产成人在线免费观看| 无码av免费一区二区三区试看| 国产欧美精品一区二区三区四区| 精品国产乱码久久久久久图片| 884aa四虎影成人精品一区| 成人久久18免费网站麻豆 | 国产精品美女久久久久久久网站| 欧美日韩免费不卡视频一区二区三区| 国产精品一级片在线观看| 亚洲午夜久久久久中文字幕久| 久久精品人人做人人综合| 欧美精品 国产精品| 日本韩国欧美在线| www.成人网.com| 黑人巨大精品欧美黑白配亚洲| 亚洲国产人成综合网站| 亚洲免费资源在线播放| 日韩免费在线观看| 91麻豆精品国产91久久久资源速度| 色一区在线观看| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 亚洲黄色免费网站| 国产欧美精品一区| 久久一夜天堂av一区二区三区| 正在播放一区二区| 欧美日韩视频第一区| 色天天综合久久久久综合片| 成人精品电影在线观看| 国产精品一二三| 国产精品综合视频| 久久99精品一区二区三区| 欧美a级一区二区| 天堂av在线一区| 婷婷一区二区三区| 日韩经典中文字幕一区| 亚洲成av人片www| 五月天激情小说综合| 日韩成人精品在线| 蜜桃av一区二区| 亚洲午夜在线视频| 一区二区日韩电影| 天天操天天干天天综合网| 婷婷开心激情综合| 亚洲尤物视频在线| 天堂久久一区二区三区| 蜜桃视频一区二区三区在线观看| 奇米一区二区三区av| 久久福利视频一区二区| 国产一区二区三区精品视频| 国产成人激情av| www.66久久| 91亚洲精品一区二区乱码| 在线亚洲高清视频| 欧洲国内综合视频| 91精品国产综合久久蜜臀| 777午夜精品视频在线播放| 日韩视频免费直播| 2021国产精品久久精品| 久久久.com| 亚洲精品免费电影| 丝袜美腿亚洲一区| 国产一区二区三区高清播放| 91视视频在线直接观看在线看网页在线看 | 国产午夜亚洲精品不卡| 亚洲午夜一区二区| 国产成人啪免费观看软件| 欧美日韩亚洲综合在线| 国产精品久久三| 蜜桃91丨九色丨蝌蚪91桃色| 91欧美一区二区| 久久午夜老司机| 亚洲高清视频的网址| 福利电影一区二区| 欧美日韩国产bt| 国产精品国产a级| 国产一区三区三区| 91精品国产综合久久久蜜臀图片| 国产精品超碰97尤物18| 国产综合久久久久久久久久久久| 欧美日韩综合在线免费观看| 国产欧美在线观看一区| 麻豆国产精品777777在线| 在线一区二区三区做爰视频网站| 国产日产亚洲精品系列| 日韩精品亚洲一区二区三区免费| 99久久久久免费精品国产| 久久久久久影视| 秋霞电影网一区二区| 欧美亚洲国产bt| 亚洲色图视频网站| www.亚洲色图.com| 国产三区在线成人av| 国产中文字幕精品| 欧美电影精品一区二区| 午夜欧美视频在线观看| 91成人在线免费观看| 亚洲欧美视频在线观看| 成人av资源在线| 国产三级精品三级| 国产成人在线色| 日本一区二区三级电影在线观看| 韩国成人福利片在线播放| 精品免费视频.| 久久成人麻豆午夜电影| 日韩美女一区二区三区四区| 日本大胆欧美人术艺术动态| 3d动漫精品啪啪一区二区竹菊| 一个色妞综合视频在线观看| 91国在线观看| 亚欧色一区w666天堂| 欧美日韩激情一区| 日韩中文欧美在线| 欧美一区二区三区婷婷月色| 青青草原综合久久大伊人精品 | 国产精品久久久久影视| 成人动漫一区二区| 中文字幕一区在线观看视频| 成人午夜在线播放| 国产精品第13页| 色偷偷久久人人79超碰人人澡| 亚洲男人天堂av网| 91久久精品日日躁夜夜躁欧美| 一区二区三区加勒比av| 欧美日韩视频一区二区| 青青草一区二区三区| 精品国产伦理网| 成人福利在线看| 亚洲自拍偷拍九九九| 91精品视频网| 国产一区二区不卡| 国产精品久久久久国产精品日日| 一本大道久久a久久综合| 亚洲成人精品影院| 日韩精品一区二区在线| 国产精品一二二区| 亚洲黄色免费电影| 日韩亚洲欧美综合| 国产成人自拍网| 一区二区三区在线观看欧美 | 1000精品久久久久久久久| 在线精品观看国产| 蜜臀av亚洲一区中文字幕| 国产欧美日韩三区| 在线观看亚洲精品| 麻豆精品视频在线观看视频| 欧美激情一区二区三区四区| 91电影在线观看| 国产在线不卡一卡二卡三卡四卡| 国产精品水嫩水嫩| 欧美美女喷水视频| 国产成人精品午夜视频免费| 亚洲久草在线视频| 日韩精品一区二区三区四区 | 欧美三级日韩三级| 精品无人码麻豆乱码1区2区| 国产精品电影院| 日韩一级片网址| 93久久精品日日躁夜夜躁欧美| 亚洲福利国产精品| 国产精品视频免费| 日韩一区二区视频在线观看| 91在线视频播放地址| 久久激五月天综合精品| 自拍av一区二区三区| 欧美大片在线观看一区二区| 91老师片黄在线观看| 激情综合网最新| 一区二区三区蜜桃网| 国产三级精品视频| 欧美一级日韩免费不卡| 91香蕉视频mp4| 国产乱人伦精品一区二区在线观看| 夜夜嗨av一区二区三区四季av | 日韩国产欧美在线视频| 国产精品电影一区二区三区| 精品少妇一区二区三区视频免付费| 在线免费观看成人短视频| 成人免费毛片嘿嘿连载视频| 奇米影视一区二区三区小说|