[問題] 有點難的搜尋演算法..
assume the input is an array of n integers with the following property:
絕對值|a[i] - a[i+1]|≦1, for i = 1,...,n-1, and a[1]<a[n]
given an integer x where a[1]≦x≦a[n],
design an algorithm to find if this array contains this x,
and if so, output one of its location(index) in this array.
use less than O(n) comparison.
請問這題應該從哪個方面下手
會比較簡易呢?
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.228.25.146
推
05/07 23:14, , 1F
05/07 23:14, 1F
→
05/07 23:15, , 2F
05/07 23:15, 2F
→
05/07 23:15, , 3F
05/07 23:15, 3F
→
05/07 23:16, , 4F
05/07 23:16, 4F
討論串 (同標題文章)
CSSE 近期熱門文章
PTT數位生活區 即時熱門文章