About 519,000 results
Open links in new tab
  1. binarySearch(A, n, num) - File Exchange - MATLAB Central

    Mar 31, 2016 · 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 …

  2. algorithm - Faster version of find for sorted vectors (MATLAB)

    function [lower_index,upper_index] = myFindDrGar(x,LowerBound,UpperBound) % fast O(log2(N)) computation of the range of indices of x that satify the % upper and lower bound …

  3. Binary Search Algorithm - Iterative and Recursive Implementation

    May 12, 2025 · Binary Search Algorithm is a searching algorithm used in a sorted array by repeatedly dividing the search interval in half. The idea of binary search is to use the …

  4. binary search Algorithm - matlab.algorithmexamples.com

    To search for a specific value in a binary search tree, the algorithm starts at the root node and compares the desired value with the value of the current node. If the desired value is equal to …

  5. Binary Search - Descending order - MATLAB Answers

    Apr 13, 2020 · I would like to know how to modify the code below so that it can work for vectors that are sorted in descending order, rather than ascending order. Your function should not sort …

  6. MATLAB-Octave/algorithms/Searching/binary_search.m at master ... - GitHub

    function p = binary_search (A,t) %% Binary Search % This function binary searches target value (t) in sorted (in increasing order) array A. % Binary search compares the target value to the …

  7. How to create binary search code - MATLAB Answers - MathWorks

    Feb 15, 2023 · I understand you are having trouble with binary search function. I believe the problem was that you were checking x with first index (i) instead of middle index m. The …

  8. How to Perform a Binary Search in a Given Array in MATLAB

    This is a binary search algorithm written in MATLAB. The function takes in an array and a value, and returns the index of the value in the array, or -1 if the value is not found.

  9. Scilab/Matlab binary search algorithm - Stack Overflow

    Feb 5, 2022 · Matlab uses 1-based array indexing. Most example code for binary search you find on the internet is probably written in a language that uses 0-based array indexing. You might …

  10. Solved In matlab 1) Implement (write the code for) ‘Binary - Chegg

    In matlab 1) Implement (write the code for) ‘Binary Search’ in Matlab. 2) Suppose an algorithm has O(2n ) complexity, where n is the size of a problem which is solved using such an …