public int ID {get; set;} public string Variation {get; set;}在使用BinarySearch之前,我可以通过SQL Order By [Variation]对列表进行排序,并按Server进行排序,或者通过List<T>.Sort()使用Web进行排序。Server: T,Web Server: IIS.
我有一个按升序排列的时间戳列表:现在,给定一个输入时间戳Instant我承认理论上可以有多个这样的t,所以搜索可以任意选择。我的想法是使我提供给Collections.binarySearch(...)的Collections.binarySearch(...)在谓词保持时返回0:
public class Timesta
short binarySearch(person key, person list[], short n) size_t mid; returnbinarySearch(key, list, mid); return binarySearch(key, list+mid+1, n-mid-1);更新:我用这种方式解决了问题(多亏了“mevets和@selbie”):
in