Why actual runtime for a larger search value is smaller than a lower search value in a sorted array?

 ̄綄美尐妖づ 提交于 2020-04-13 16:59:50

问题


I executed a linear search on an array containing all unique elements in range [1, 10000], sorted in increasing order with all search values i.e., from 1 to 10000 and plotted the runtime vs search value graph as follows:

Upon closely analysing the zoomed in version of the plot as follows:

I found that the runtime for some larger search values is smaller than the lower search values and vice versa

My best guess for this phenomenon is that it is related to how data is processed by CPU using primary memory and cache, but don't have a firm quantifiable reason to explain this.

Any hint would be greatly appreciated.

来源:https://stackoverflow.com/questions/60925228/why-actual-runtime-for-a-larger-search-value-is-smaller-than-a-lower-search-valu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!