/**
* @author : irfanudin ridho
* @email : irfan.ub@gmail.com
* @date : December 24, 2010
* @version : 1.0
*
* This function provide search algorithm and it give the index
* number of the desired values
*
* @param data Arrays of the data
* @param value the desired value
* @return i index of the value
*/
function linearSearch(data, value){
for(i=0;i<data.length;i++){
if(data[i]==value){
return i;
}
}
return "No found match!";
}
No comments:
Post a Comment