正在加载图片...
Sequential Search and Analysis Begin at one end of the list and scan down it until the desired key s found or the other end is reached: 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 *t 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; 四川大学计算机(软件)学院四川大学 计算机(软件)学院 Sequential Search and Analysis Begin at one end of the list and scan down it until the desired key is found or the other end is reached: 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; }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有