III search algorithm

xiaoxiao2021-04-01  219

The two-point lookup algorithm is based on the number of sequences that have been ranked. This is its implementation:

#include #include #include

// Di-binary look

INT FIND (INT * RESULT, INT KEY, INT LEN) {Int First, End, MID; First = 0; End = LEN-1; WHILE (First <= End) // Note He is equal to {MID = (First END / 2; if (Result [MID] == Key) {RETURN 1;} else if (Result [MID]> key) {end = mid-1;} else {first = MID 1;}} return 0 ;

}

INT main () {int value [10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int res = find (value, 4, 10); printf ("% D / N ", RES);

Return 0;}

转载请注明原文地址:https://www.9cbs.com/read-131094.html

New Post(0)