1. 问题
在一个排好序的数组T[1…n]中查找x,如果x在T中,输出x在T的下标j;如果x不在T中,输出j=0.
2. 解析
以下面一数组T为例:
假设在数组T中查找数字6,则经过的步骤如下:①InsertionSearch(T,6,0,24)→low=0,high=24,mid=0
②InsertionSearch(T,6,1,24)→low=1,high=24,mid=1
③InsertionSearch(T,6,2,24)→low=2,high=24,mid=2
④T[mid]=6
3. 设计
4. 分析
时间复杂度:O(log2(log2n))
5. 源码
https://github.com/Wang-2333/InsertionSearch/blob/master/InsertionSearch/InsertionSearch.cpp