3 people like it.
Like the snippet!
Simple binary search of an array. Tests the array at the middle and divides the search space by half each time it looks for the target item. Returns the target item and how many iterations it took to get there
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: |
|
Link: | http://fssnip.net/ig |
Posted: | 11 years ago |
Author: | devshorts |
Tags: | binary search , trees , algorithms |