56 return Hunt(value,prevIndex);
62 return Bisection(value,0,mpArray->Size());
67 return Bisection(value,lowerLimit,mpArray->Size());
75 const T& value,
TIndex guessIndex)
const
78 TIndex n = mpArray->Size();
80 if (guessIndex<0 || guessIndex>=n)
82 return Bisection(value);
85 bool ascending = (*mpArray)[n-1] >= (*mpArray)[0];
89 if ( (value >= (*mpArray)[guessIndex]) == ascending)
91 if (guessIndex == n-1)
94 upperLimit = guessIndex+1;
95 while ( (value >= (*mpArray)[upperLimit]) == ascending)
97 guessIndex = upperLimit;
102 result=Bisection(value,guessIndex);
115 upperLimit = guessIndex--;
116 while ( (value < (*mpArray)[guessIndex]) == ascending)
118 upperLimit = guessIndex;
120 if (inc >= upperLimit)
122 result = Bisection(value,0,upperLimit);
129 guessIndex = upperLimit-inc;
132 return Bisection(value,guessIndex,upperLimit);
137 const T& value,
TIndex lowerLimit,
TIndex upperLimit)
const
140 bool ascending = (*mpArray)[mpArray->Size()-1] >= (*mpArray)[0];
141 while (upperLimit-lowerLimit > 1)
143 TIndex midPoint = (upperLimit+lowerLimit)>>1;
144 if ( (value >= (*mpArray)[midPoint]) == ascending)
145 lowerLimit = midPoint;
147 upperLimit = midPoint;