메뉴 건너뛰기

app

binary_search.

박영식2003.11.05 19:51조회 수 3243댓글 0

    • 글자 크기
int CRandom::binarySearch(int bs[], int n, int target)
{
        int first(0); int last(n-1); int mid;
        while(first<=last)
        {
                cnt++;
                mid = (first+last)/2;
                if(target==bs[mid])
/*                        if(a==-1){
                                printf("dd");
                                return (mid-(100-a));}
                        else*/
                                return mid;
                else if(target<bs[mid])
                        last=mid-1;
                else
                        first=mid+1;
        }
        return -1;
}
박영식 (비회원)
    • 글자 크기
interpolationSearch (by 박영식) 조합 구하기. (by 박영식)

댓글 달기

이전 1 ... 6 7 8 9 10 11 12 13 14 15다음
첨부 (0)
위로