+0  
 
+20
729
1
avatar+1886 

Compute how many steps binary search would take to find an item in arrays of various sizes.

 Oct 25, 2016

Best Answer 

 #1
avatar+118608 
+5

let 

\(T_0=2,\;\;\;T_1=3 \qquad \dots \qquad T_{14}=47,\;\;\;T_{15}=53, \qquad ... T_{63}=311 \)

 

About 7 

 

\(T_{( \lfloor 0.5(0+63)\rfloor)}=T_{31}=too\;big\\ T_{( \lfloor 0.5(0+31)\rfloor)}=T_{15}=53=too\;big\\ T_{( \lfloor 0.5(0+15)\rfloor)}=T_{7}=19=too\;small\\ T_{( \lfloor 0.5(7+15)\rfloor)}=T_{11}=37=too\;small\\ T_{( \lfloor 0.5(11+15)\rfloor)}=T_{13}=43=too\;small\\ T_{( \lfloor 0.5(13+15)\rfloor)}=T_{14}=47=too\;small\\ T_{( \lfloor 0.5(14+15)\rfloor)}=T_{14}=47=umm\; already\; seen\;that\;one.\\ \text{Conclusions: 52 is not a prime number} \)

 Oct 25, 2016
 #1
avatar+118608 
+5
Best Answer

let 

\(T_0=2,\;\;\;T_1=3 \qquad \dots \qquad T_{14}=47,\;\;\;T_{15}=53, \qquad ... T_{63}=311 \)

 

About 7 

 

\(T_{( \lfloor 0.5(0+63)\rfloor)}=T_{31}=too\;big\\ T_{( \lfloor 0.5(0+31)\rfloor)}=T_{15}=53=too\;big\\ T_{( \lfloor 0.5(0+15)\rfloor)}=T_{7}=19=too\;small\\ T_{( \lfloor 0.5(7+15)\rfloor)}=T_{11}=37=too\;small\\ T_{( \lfloor 0.5(11+15)\rfloor)}=T_{13}=43=too\;small\\ T_{( \lfloor 0.5(13+15)\rfloor)}=T_{14}=47=too\;small\\ T_{( \lfloor 0.5(14+15)\rfloor)}=T_{14}=47=umm\; already\; seen\;that\;one.\\ \text{Conclusions: 52 is not a prime number} \)

Melody Oct 25, 2016

3 Online Users