C13查找概要1.ppt

C13查找概要1

Vocabulary sequential search 顺序查找 element 元素 order 次序 binary search 二分查找 target 目标 algorithm 算法 array 数组 location 位置 object 对象,目标 parameter 参数 index 下标,索引,指针 sentinel 哨兵 probability 概率 key 关键字 hash 散列,杂凑 collision 冲突 cluster 聚集,群集 synonym 同义语,同义词 probe 探测 load factor 装填因子 Searching One of the most common and time-consuming operations in computer science. To find the location of a target among a list of objects. Main contents(in chapter 2) List searching(including two basic search algorithms) Sequential search(including three variations) Binary search Hashed list searching—the key through an algorithmic function determines the location of data Collision resolution To discuss the list search algorithms using an array structure 2-1 list searches (work with arrays) Sequential search(any array) Small lists Not searched often Sequential search algorithms Needs to tell the calling algorithm two things Did it Find the data it was looking for? If it did, at what index are the target data found. Requires four parameters The list we are searching An index to the last element in the list The target The address where the found element’s index location is to stored sequential search algorithm algorithm seqsearch(val list array val last index val target keytype ref locn index) looker=0 loop (looker last and target not equal list [looker]) looker = looker + 1 end loop locn = looker if (target equal list [looker]) found = true else found = false end if return found end seqsearch Variations on sequential searches Sentinel search Probability search Ordered list search Sentinel search algorithm seqsearch(val list array val last index val target keytype ref locn index) List [last + 1] = target looker=0 loop (target not equal list [

文档评论(0)

1亿VIP精品文档

相关文档