<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>obelisk2</author_name>
  <author_url>https://blog.hatena.ne.jp/obelisk2/</author_url>
  <blog_title>Camera Obscura</blog_title>
  <blog_url>https://obelisk.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
    <anon>アルゴリズム</anon>
  </categories>
  <description>練習問題 2.3-5 数字の入った配列の中から、引数に一致する要素のインデックスを返します。そのような要素がなければ nil を返します。配列はソートされている必要があります。マージソートのように、配列を再帰的に半分づつにしていって探します。最悪実行時間は Θ(lg n) です。Ruby でやりました。 binary_search.rb（2017/6/30 修正） class Array def binary_search(n) ar = dup i = ar.size / 2 return nil if n &lt; ar[0] or n &gt; ar[-1] return i if ar[i] ==…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fobelisk.hatenablog.com%2Fentry%2F2016%2F01%2F26%2F011049&quot; title=&quot;2分探索（バイナリサーチ） - Camera Obscura&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://images-fe.ssl-images-amazon.com/images/I/51foeCpfmQL._SL160_.jpg</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2016-01-26 01:10:49</published>
  <title>2分探索（バイナリサーチ）</title>
  <type>rich</type>
  <url>https://obelisk.hatenablog.com/entry/2016/01/26/011049</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
