This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: int m=l +(h-l)/2; if(a[m]==value) return ,; else(if a[m]> value) h=m-1; else l=m+1; } return -1; }hz bookkeeping (low/high) ^low ^high idea: at each step value bust be in range of a[l] and a[h] [ ] or [ ] ^n, l n ^l ^n N time complexity suppose =2^k -1 o(k)=O(log n) if n=1000000 elements, about 20 probes if n=1,000,000,000, about 30 probes...
View Full Document