问题
单项选择题
对100个数据元素采用折半查找法,最大比较次数为( )。
A.6
B.7
C.8
D.9
答案
参考答案:B
解析:[分析] 对折半查找,首先将待查记录所在范围缩小一半,然后逐步缩小,对100个元素的顺序表,第一次比较范围缩小到50,第二次缩小到25,第三次缩小到13,第四次缩小到7,第五次缩小到4,第六次缩小到2,第七次就可以找到查找的元素。
对100个数据元素采用折半查找法,最大比较次数为( )。
A.6
B.7
C.8
D.9
参考答案:B
解析:[分析] 对折半查找,首先将待查记录所在范围缩小一半,然后逐步缩小,对100个元素的顺序表,第一次比较范围缩小到50,第二次缩小到25,第三次缩小到13,第四次缩小到7,第五次缩小到4,第六次缩小到2,第七次就可以找到查找的元素。
补全对话(共5小题,每小题1分,满分5分)
Many a young person tells me he wants to be a writer. I always encourage such people, but I also explain that there's a big difference between "being a writer" and "writing".小题1:________ "You've got to want to write," I say to them, "not want to be awriter." The reality is that writing is a lonely, private and poorly-paid affair. 小题2:________ When I left a 20-year job in the US Coast Guard to become a writer, I had no hopes at all. 小题3:________ . It didn't even matter that it was cold and had no bathroom. I immediately bought a used typewriter and felt like a real writer. After a year or so, however, I still hadn't gotten a break and began to doubt myself. 小题4:_______ But I knew I wanted to write. I had dreamed about it for years. I wasn't going to be one of those people who die wondering "What if... ?" I would keep putting my dream to the test even though it meant living with uncertainty and fear of failure. 小题5:________ . |