草庐IT

houseLocations

全部标签

java - 为什么 Arrays.binarySearch 与遍历数组相比没有提高性能?

我尝试解决HackerlandRadioTransmittersprogrammingchallange.总而言之,挑战如下:Hackerlandisaone-dimensionalcitywithnhouses,whereeachhouseiislocatedatsomexionthex-axis.TheMayorwantstoinstallradiotransmittersontheroofsofthecity'shouses.Eachtransmitterhasarange,k,meaningitcantransmitasignaltoallhouses≤kunitsofdist

java - 为什么 Arrays.binarySearch 与遍历数组相比没有提高性能?

我尝试解决HackerlandRadioTransmittersprogrammingchallange.总而言之,挑战如下:Hackerlandisaone-dimensionalcitywithnhouses,whereeachhouseiislocatedatsomexionthex-axis.TheMayorwantstoinstallradiotransmittersontheroofsofthecity'shouses.Eachtransmitterhasarange,k,meaningitcantransmitasignaltoallhouses≤kunitsofdist