Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ricerca_binaria(v,x)
- {
- var a=v[0],b=v.lenght,m;
- if(a>b){return;}
- else
- { m=Math.floor(b/2);
- if(v[m]==x)
- {
- return x;
- }else
- { if(x<v[m])
- {
- b=m;
- ricerca_binaria(v,x,a,b);
- }
- else
- { a=m;
- ricerca_binaria(v,x,a,b);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement