binarySearch(A, n, num)
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
Author: Trong Hoang Vo
hoangtrong2305@gmail.com
Date: March 31, 2016
Cita come
Trong Hoang Vo (2026). binarySearch(A, n, num) (https://it.mathworks.com/matlabcentral/fileexchange/56271-binarysearch-a-n-num), MATLAB Central File Exchange. Recuperato .
Compatibilità della release di MATLAB
Compatibilità della piattaforma
Windows macOS LinuxCategorie
Tag
Scopri Live Editor
Crea script con codice, output e testo formattato in un unico documento eseguibile.
| Versione | Pubblicato | Note della release | |
|---|---|---|---|
| 1.0 |
|
