- 3
- 0
- 约2.71千字
- 约 6页
- 2018-01-18 发布于河南
- 举报
perl 二分法查找
#!/usr/bin/perl-w@array=(a,f,b,c,d,ab,e,7,8,23,9);@list=sort(@array);print please input the content you want to look for \n;print if the content exists ,you will get the position\n;chomp ($k=STDIN);$min=0;$max=$#list;if($k lt $list[$min] or $k gt $list[$max]){ printNOT EXIST!\n;}else{ while($k ge $list[$min] and $k le $list[$max]) { if($k eq $list[$min]) { print the content is in NO. ; print $min+1; print \n; last; } elsif($k eq $list[$max]) { print the content is in NO. ; print $max+1; print \n; last; } else { $i=($min+$max)/2;
您可能关注的文档
最近下载
- 2026年护理导论考试题目及答案.doc VIP
- 1999年江苏省南京市中考数学试卷【中考数学试题,含答案】.pdf VIP
- DB64_T 1902-2023 医疗机构能耗定额.docx VIP
- 建筑功能之流线.pptx VIP
- 2026年4月高等教育自学考试《中国近现代史纲要》全国统一试卷及答案.docx VIP
- 2026版婴幼儿尿布性皮炎护理实践专家共识PPT课件.pptx VIP
- 武汉东湖学院《财务管理》2025 - 2026学年第一学期期末试卷.docx VIP
- 农业物联网技术标准与规范手册.docx VIP
- 武汉学院《财务管理》2025 - 2026学年第一学期期末试卷.docx VIP
- 2018年度湖南省国际航空发展省级专项资金绩效评价报告.docx
原创力文档

文档评论(0)