Top "Binary-search" questions

Binary search is an efficient algorithm for finding an element in a sorted array.

Implement binary search in objects

Is there any way to implement binary search in a ArrayList with objects? In this example the ArrayList will be …

java search collections binary-search
Which is faster, Hash lookup or Binary search?

When given a static set of objects (static in the sense that once loaded it seldom if ever changes) into …

algorithm hash hashmap lookup binary-search
Binary search of a sorted array

I am trying to search a descending sorted array using this binary search code. However, after I sort it, and …

c# arrays binary-search
How many comparisons will binary search make in the worst case using this algorithm?

Hi there below is the pseudo code for my binary search implementation: Input: (A[0...n-1], K) begin l ← 0; r ← n-1 …

arrays algorithm complexity-theory binary-search
How to use recursion in creating a binary search algorithm

I have been using my time off university to practice Java through coding algorithms. One of the algorithms I coded …

java algorithm binary-search
Find the first element in a sorted array that is greater than the target

In a general binary search, we are looking for a value which appears in the array. Sometimes, however, we need …

arrays algorithm binary-search
how to apply binary search O(log n) on a sorted linked list?

Recently I came across one interesting question on linked list. Sorted singly linked list is given and we have to …

algorithm data-structures linked-list binary-search asymptotic-complexity
Using Binary Search with sorted Array with duplicates

I've been tasked with creating a method that will print all the indices where value x is found in a …

java duplicates binary-search
Insertion Sort with binary search

When implementing Insertion Sort, a binary search could be used to locate the position within the first i - 1 elements …

algorithm sorting binary-search insertion-sort
Binary Search in Array

How would I implement a binary search using just an array?

algorithm arrays language-agnostic search binary-search