静态查找表

    技术2022-05-11  9

    #include #include typedef int KeyType; typedef struct { KeyType key; } ElemType; typedef struct { ElemType * elem; int length; }SSTable; void Display(SSTable ST); void InitSStable(SSTable& ST) { ST.length = 120000000; ST.elem = (ElemType *) malloc(ST.length * sizeof(ElemType)); //int values[] = {5,13,19,31,37,56,64,75,80,88,92}; for (int i = 1; i < ST.length; i++) { ElemType elem; //elem.key = values[i - 1]; elem.key = i; ST.elem[i] = elem; } } void Display(SSTable ST) { int total = ST.length; for (int i = 1; i < total; i++) { cout< < key){ high = mid - 1; } else { low = mid + 1; } } return 0; } void main() { SSTable ST; InitSStable(ST); //Display(ST); //cout<

    最新回复(0)