previous | start | next

Linear Search Algorithm

public class Purse
{
public boolean find(Coin aCoin)
{
for (int i = 0; i < coins.size(); i++)
{
Coin c =(Coin)coins.get(i);
if (c.equals(aCoin)) return true; //found a match
}
return false; //no match in the entire array list
}
...
}


previous | start | next