问题:
有一个100层高的大厦,你手中有两个相同的玻璃围棋子。从这个大厦的某一层扔下围棋子就会碎,用你手中的这两个玻璃围棋子,找出一个最优的策略,来得知那个临界层面.
参考答案:
One drop allows us to test 1 floor.
Two drops can test 3 floors: Test the second floor first. If it breaks, test the first floor with the other ball. If not, test the top floor with either ball.
Three drops can test 6 floors: Test the third floor first. If it breaks, test the bottom 2 floors in order with the other ball. If not, test the top 3 floors as described above.
Four drops can test 10 floors: Test the fourth floor first. If it breaks, test the bottom 3 floors in order with the other ball. If not, test the top 6 floors as described above.
N drops allows you to test the number of floors equal to the sum of 1 to n. Fourteen drops can test 105 floors: Test the fourteenth floor first. If it breaks, test the bottom 13 floors in order with the other ball. If not, test the twenty-seventh floor next (14 3), and so on.
For any given drop, the number of drops you’ll need after that should be the same if that ball breaks or not (or sometimes they are off by 1 if your total is not an even sum-of-1-to-n).
The optimum test protocol for 100 floors, then, requires a maximum of 14 drops. The next step is to derive a testing strategy that divides the 100 floors using the series 14+13+12+11+10+9+8+7+6+5+4+3+2+1.
The best testing strategy starts with a drop from floor 14; then a drop from floor 27 (14+13); then 39 (14+13+12);etc. The full pattern is 14, 27, 39, 50, 60, 69, 77, 84, 90, 95, 99, 100.
In practice, this series sacrifices the first ball to point to an everdecreasing series of possible target floors. A small number of drops using the second ball then identifies the target floor. Simply go back to the previously tested floor and start working up a floor at a time.
Eventually,you will determine the floor at which the bowling ball shatters.
This is the most efficient testing algorithm.
分享到:
相关推荐
软件测试策略模板.docx软件测试策略模板.docx软件测试策略模板.docx软件测试策略模板.docx软件测试策略模板.docx软件测试策略模板.docx软件测试策略模板.docx软件测试策略模板.docx
软件测试,软件测试策略,软件测试策略培训文档
黑盒测试策略以及方法详细描述有案例以及说明
测试策略编写方法和需要注意的地方,大家参考下,有不一样的互相交流
系统测试策略模板,可指导测试人员对系统的测试范围、重点和策略进行分析和描述。
软件性能测试评估模型,测试策略,业务吞吐量
性能测试策略的模板,word版还成
测试策略描述测试工程的总体方法和目标。描述目前在进行哪一阶段的测试(单元测试、集成测试、系统测试)以及每个阶段内在进行的测试种类(功能测试、性能测试、覆盖测试等)
软件测试之多模块测试策略,压力测试、阿尔法测试,贝塔测试
测试策略的分享表
测试策略、方法文档培训资料,非常有用!培训资料!
测试策略的制定方法PPT教程主要用于公司内部人员培训。
测试策略、方法文档-2,培训资料,非常有用!
敏捷开发模式下测试策略综述 2 过程管理角色 2 测试开发角色 2 持续交付 3 持续交付,是在产品开发过程……能够以较短地周期完成需求的小粒度频繁交付;频繁的交付周期【2~5周】带来了更迅速的对产品的反馈和改善...
HTSM,启发式测试策略,帮助我们在进行测试设计时提高覆盖面,从源端避免遗漏
摄像头硬件测试策略,用于测试用例编写指导,用导图的方式展开测试用例的编写
测试策略分类测试策略分类
本文档编写了本人从业4年的测试心法,其中包括了测试相关的方法,以及测试所包含的大致内容,以及测试过程中涉及到的相关知识点。
软件测试的复杂性分析 软件测试基本技术 软件测试策略
SDV阶段:制定测试策略、制定测试方案、测试用例、测试执行,完成项目所有需求测试 SVT阶段:完成功能及性能规格和指标验证 版本准入准出: SDV准入条件: 1)开发人员编码结束,并已完成自测试。 2)需求说明书规定...