binarySearch(A, n, num)

This function find number in array (sorted) using binary search
1,1K download
Aggiornato 31 mar 2016

Visualizza la licenza

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
Creato con R2014a
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Shifting and Sorting Matrices in Help Center e MATLAB Answers
Versione Pubblicato Note della release
1.0