메뉴 건너뛰기

app

binary_search.

박영식2003.11.05 19:51조회 수 3238댓글 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 박영식)

댓글 달기

박영식
2003.11.05 조회 17501
박영식
2003.11.05 조회 2282
박영식
2003.11.05 조회 2464
박영식
2003.11.05 조회 2179
박영식
2003.11.05 조회 2199
박영식
2003.11.05 조회 3238
박영식
2002.06.14 조회 2582
박영식
2002.04.18 조회 3377
박영식
2002.04.18 조회 3247
이전 1 ... 5 6 7 8 9 10 11 12 13 14 다음
첨부 (0)
위로