线性和二进制搜索功能
在此作业中,您将编写四个搜索功能:
linearSearch
recursiveLinearSearch
binarySearch
recursiveBinarySearch
这些函数正在搜索类型为Item的数组。 Item类定义为:
public class Item
{
private int myCatNum, myInventory;
public Item ( int nNum , int nInv )
{
myCatNum = nNum;
myInventory = nInv;
}
public int getCatNum (){ return myCatNum;}
public int getInventory (){ return myInventory;}
}