while
-style and recursive implementations at the top of
OrderedList_inArraySlots.java
Java API on the indexOf
method
based on solutionsHolmes/5D_genericTypes/OrderedList_inArraySlots_v2/ as of 2019-04-10 04:48
-
state the problem Find the index of a given number in an ordered arrayList.
-
recursive abstraction When I'm asked to find the index of a given number in an ordered arrayList, the recursive abstraction can find the index of a given number in half of the original arrayList.
-
identify
- decision of whether to go to b. or c.
if (low > hi)
- solution to the base case
return -1;
- solutions to the recursive case
- combine (N/A)
- recursive abstraction
indexOf_recursive( findMe, low, pageToCheck - 1);
indexOf_recursive( findMe, pageToCheck + 1, hi);
- leftover (N/A)