タグ

ブックマーク / www.kt.rim.or.jp/~kbk (1)

  • ときどきの雑記帖' 2013年4月(上旬)

    ■_ にぶんたんさく Route 477 - Ruby 2.0のRange#bsearchが無限区間の二分探索に対応している件 なんの偶然かこういう記事も(内容は被ってません。単に「二分探索」を取りあげているだけ) Efficient Binary Search | rootkea bool bsearch(int array[], int size, int *loc, int val) { int first, mid, last; int count; first = 0; last = size - 1; count = 0; while(first <= last) //Unless first and last crosses each other { printf("Pass %d\n", ++count); mid = first + (last - first)/2; i

    h6n
    h6n 2013/04/05
  • 1