mramine364

linearSearch

May 23rd, 2016
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function linearSearch(arr, n){
  3.     for(var i=0;i<arr.length;i++){
  4.         if( arr[i]==n )
  5.             return i;
  6.     }
  7.     return -1;
  8. }
Advertisement
Add Comment
Please, Sign In to add comment