This function find number in array (sorted) using binary search
软件应用简介

Syntax: [index] = binarySearch(A, n, num);
Inputs: A: Array (sorted) that you want to search
n: Length of array A
num: Number you want to search in array A
Outputs: index: Return position in A that A(index) == num or -1 if num does not exist in A
Complexity: O(1) best-case performance
O(log_2 (n)) worst-case performance
O(1) auxiliary space
界面展示

结果示意

规格 价
0元试用 |
---|
0.0元人民币/月 |
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!