{"author_url":"https://blog.hatena.ne.jp/uraway/","published":"2019-12-18 08:00:00","blog_url":"https://uraway.hatenablog.com/","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Furaway.hatenablog.com%2Fentry%2F2019%2F12%2F18%2F080000\" title=\"\u30d0\u30a4\u30ca\u30ea\u30b5\u30fc\u30c1 - \u6587\u7cfb\u30d7\u30ed\u30b0\u30e9\u30de\u30fc\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","url":"https://uraway.hatenablog.com/entry/2019/12/18/080000","blog_title":"\u6587\u7cfb\u30d7\u30ed\u30b0\u30e9\u30de\u30fc","image_url":"https://chart.apis.google.com/chart?cht=tx&chl=%7B%5Cdisplaystyle%0A%5Cbegin%7Baligned%7D%0A1%20%26%3D%20n%28%5Cfrac%7B1%7D%7B2%7D%29%20%5Ek%20%5C%5C%0An%20%26%3D%202%5Ek%20%5C%5C%0Ak%20%26%3D%20%5Clog_2%20n%20%0A%5Cend%7Baligned%7D%0A%7D","categories":["algorithm"],"width":"100%","height":"190","title":"\u30d0\u30a4\u30ca\u30ea\u30b5\u30fc\u30c1","provider_url":"https://hatena.blog","author_name":"uraway","type":"rich","version":"1.0","description":"\u30d0\u30a4\u30ca\u30ea\u30b5\u30fc\u30c1 \u554f: \u30bd\u30fc\u30c8\u3055\u308c\u305f\u6570\u5024\u306e\u914d\u5217\u3068\u6570\u5024target\u3092\u53d7\u3051\u53d6\u308a\u3001\u914d\u5217\u4e2d\u306etarget\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u6c42\u3081\u308b\u3002\u305d\u306e\u969b\u3001\u30d0\u30a4\u30ca\u30ea\u30b5\u30fc\u30c1\u3092\u7528\u3044\u308b\u3053\u3068\u3002 \u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u5b9f\u88c5 $O(\\log n)$ \u914d\u5217\u306e\u8981\u7d20\u6570\u3092n\u3068\u3057\u305f\u3068\u304d\u3001left=0\u3001right=n\u306e\u5909\u6570\u3092\u4f5c\u308b\u3002\u307e\u305f\u3001left\u3068right\u306e\u4e2d\u592e\u306e\u4f4d\u7f6e\u3092mid\u3068\u3059\u308b\u3002 array[mid] === target\u306a\u3089target\u304c\u898b\u3064\u304b\u3063\u305f\u3068\u3057\u3066\u63a2\u7d22\u7d42\u4e86\u3002left >= right\u306a\u3089\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u3068\u3057\u3066\u63a2\u7d22\u7d42\u4e86\u3002 array[mid] > target\u306a\u3089target\u306f\u914d\u5217\u306e\u5de6\u534a\u5206\u306b\u3042\u308b\u306e\u3067\u3001right=mid-1\u3068\u3057\u30660\u3078 array[\u2026","provider_name":"Hatena Blog"}