Guest User

exposearch

a guest
May 11th, 2017
775
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.26 KB | None | 0 0
  1. function [ array, N, mini, target ] = exponentialSearch( array, N, target)
  2.  
  3. array = 1:N;
  4. bound = 1;
  5. target = 1:N;
  6.  
  7. while (bound < N && array(bound) < target)
  8.     bound = bound*2;
  9. end
  10.  
  11. mini = min(bound, N)
  12.  
  13. binarySearch(array, (bound/2), mini, target);
  14.  
  15. end
Advertisement
Add Comment
Please, Sign In to add comment