满意答案
(1)查e
Step1: a b c d e f g
↑ ↑ ↑
low mid high d<e low=mid + 1;
Step2: a b c d e f g
↑ ↑ ↑
low mid high f>e high=mid – 1;
Step 3: a b c d e f g
↑
low/high
mid e==e return mid ;
(2)查f
Step 1: a b c d e f g
↑ ↑ ↑
low mid high d<f low=mid + 1;
Step 2: a b c d e f g
↑ ↑ ↑
low mid high f==f return mid;
(3)查g
Step 1: a b c d e f g
↑ ↑ ↑
low mid high d<g low=mid + 1;
Step 2: a b c d e f g
↑ ↑ ↑
low mid high f<g low=mid + 1;
Step 3: a b c d e f g
↑
low/high
mid g==g return(mid);
00分享举报