You can make a dichotomic search. About log2n test instead of n/2.
Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."
In reply to Re: find closest element of array without going over
by psini
in thread find closest element of array without going over
by sadfaceman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |