Example of Java using dichotomy to find and sort
•
Java
To realize the dichotomy search, the array needs to be an orderly sequence. The dichotomy search is more efficient than the linear search: the more elements of the array, the more obvious the efficiency improvement. The efficiency of dichotomy search means that O (log2n) n is in the M-power range of 2, the maximum number of searches is m, log2n means that the M-power of 2 is equal to N, and the constant is omitted, Abbreviated as O (logn) if there is an ordered array of 200 elements, the maximum number of binary lookups is 2 ^ 7 = 128 and 2 ^ 8 = 256. It can be seen that the power of 7 is less than 200 and the power of 8 is included, so the maximum number of lookups is equal to 8
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码