文件名称:FindStringInSortedArray
介绍说明--下载内容均来自于网络,请自行研究使用
通过递归实现二分法,以递归的方式能快捷直接的实现平时要比较麻烦的二分法查询功能-// Function: FindStringInSortedArray
// Usage: index = FindStringInSortedArray (key, array, n)
// -------------------------------------------------------------
// The function searchs the array looking for the specified key.
// The argument n specifies the effective size of the array, which must
// be sorted according to the lexicographic order imposed by StringCompare.
// If the key is found, the order imposed by StringCompare. If the key is found, the order imposed by
// StringCompare. If the key is found, the function returns the index in the array at which that key appears.
// (If the key appears more than once in the array, any of the mathcing indices may be returned). If the key
// does not exist in the array, the funcion returns-1. In this implementation, FindStringInSortedArray is simply
// a wrapper all the work is done by the recursive function BinarySearch.
// Usage: index = FindStringInSortedArray (key, array, n)
// -------------------------------------------------------------
// The function searchs the array looking for the specified key.
// The argument n specifies the effective size of the array, which must
// be sorted according to the lexicographic order imposed by StringCompare.
// If the key is found, the order imposed by StringCompare. If the key is found, the order imposed by
// StringCompare. If the key is found, the function returns the index in the array at which that key appears.
// (If the key appears more than once in the array, any of the mathcing indices may be returned). If the key
// does not exist in the array, the funcion returns-1. In this implementation, FindStringInSortedArray is simply
// a wrapper all the work is done by the recursive function BinarySearch.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
FindStringInSortedArray.c