메뉴 건너뛰기

app

interpolationSearch

박영식2003.11.05 19:52조회 수 2361댓글 0

    • 글자 크기
int CRandom::interpolationSearch(int search_key, int key[], int n)
{
        int index=0, low =0, high=NUM-1, output=0;
        cnt=0;
        while(low <= high && output ==0)
        {
                cnt++;
                if(search_key == key[index]){
                        output=index;
                        return(index+1);
                }
                else{
//                printf("index = %dt",index);
                        index=low + (int)((float)((search_key-key[low])*(high-low))/(key[high]-key[low]));
        }
                if (search_key < key[index]){
                        high=index-1;
                }
                else{
                        low=index+1;
                }

        }
        return index+1;
}
박영식 (비회원)
    • 글자 크기
linearSearch & lsmf (by 박영식) binary_search. (by 박영식)

댓글 달기

박영식
2006.06.18 조회 2524
박영식
2005.03.25 조회 2253
박영식
2003.12.25 조회 4050
박영식
2003.12.19 조회 3610
박영식
2003.11.05 조회 17689
박영식
2003.11.05 조회 2418
박영식
2003.11.05 조회 2624
박영식
2003.11.05 조회 2323
박영식
2003.11.05 조회 2361
박영식
2003.11.05 조회 3386
박영식
2002.06.14 조회 2732
박영식
2002.04.18 조회 3536
박영식
2002.04.18 조회 3434
첨부 (0)
위로