Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. public class BinarySearch{
  2.  
  3.  
  4. public BinarySearch(){
  5.  
  6. }
  7.  
  8.  
  9. /**
  10. * Do binary search here
  11. * return - The index of where val is in words
  12. *
  13. **/
  14. public int search(String[] words, String val){
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21. }
  22.  
  23.  
  24.  
  25.  
  26. public static void main(String[] args){
  27.  
  28. String[] words = {"a, b, c, d, e"};
  29. String val = "c";
  30. BinarySearch bs = new BinarySearch();
  31.  
  32. if(bs.search(words, val) == >= 0){
  33. System.out.println("Word found");
  34. } else {
  35. System.out.println("Word not found");
  36. }
  37.  
  38.  
  39. }
  40.  
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement