perlquestion
Limbic~Region
Lazy web,
<br />
I am looking for help constructing a modified binary search.
<p>
I have a large array of strings which contain duplicates sorted in ASCIIbetical order. Given two strings ($beg & $end), I want to find the number of elements in the array that are between the two points. My idea was to first perform a binary search to find the index of the nearest element to $beg and then $end and do some math.
</p>
<p>
Here are the two things that lead me to ask you dear lazy web.
<ul>
<li>For $beg, I am looking for the first index (closest to 0) where <c>$list[$idx] ge $beg</c></li>
<li>For $end, I am looking for the last index (closest to $#list) where <c>$list[$idx] le $end</c></li>
</ul>
</p>
<div class="pmsig"><div class="pmsig-180961">
<p>
Cheers - [Limbic~Region|L~R]
</p>
</div></div>