# Exercise 10.10 from Think Julia book

**URL:** <https://discourse.julialang.org/t/exercise-10-10-from-think-julia-book/73592>\
**Category:** New to Julia\
**Created:** [December 24, 2021, 6:58pm UTC](https://discourse.julialang.org/t/exercise-10-10-from-think-julia-book/73592 "2021-12-24T18:58:29Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![Bardo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bardo/32/21601_2.png) [@Bardo](https://discourse.julialang.org/u/Bardo)\
**Post date:** [December 28, 2021, 11:25pm UTC](https://discourse.julialang.org/t/exercise-10-10-from-think-julia-book/73592/8 "2021-12-28T23:25:08Z")

</div>

Your questions appear to be about algorithms.  
You can find some ideas in:  
[Introduction to the Analysis of Algorithms by Robert Sedgewick and Philippe Flajolet (princeton.edu)](https://aofa.cs.princeton.edu/home/)  
[Algorithms - GeeksforGeeks](https://www.geeksforgeeks.org/fundamentals-of-algorithms/)  
[Data Structure and Algorithms Tutorial (tutorialspoint.com)](https://www.tutorialspoint.com/data_structures_algorithms/index.htm)  
among others.

For the fun of it and to see how others are doing:  
[Julia on Exercism](https://exercism.org/tracks/julia/exercises)  
[Codewars - Achieve mastery through coding practice and developer mentorship](https://www.codewars.com/)

The [big O notation](https://en.wikipedia.org/wiki/Big_O_notation) is to be taken with a grain of salt, as it is an asymptotic value and neglects possibly large factors. See [https://discourse.julialang.org/t/fastest-data-structure-for-a-priority-queue/68472](https://discourse.julialang.org/t/fastest-data-structure-for-a-priority-queue/68472)

A small modification of the code there gives:

```julia
function findbinsearch(item, collection)
    len = length(collection)
    left = 1
    right = len
    found = false
    while left <= right
        mid = (left + right) >> 1
        if collection[mid] == item
            found = true
            break
        end
        if collection[mid] > item
            right = mid - 1
        else
            left = mid + 1
        end
    end
    found
end

collection = ["tata", "titi", "toto"]

findbinsearch("tati", collection) # -> false
findbinsearch("toto", collection) # -> true
findbinsearch("titi", collection) # -> true
findbinsearch("tata", collection) # -> true

```

---

_[View the full topic](https://discourse.julialang.org/t/exercise-10-10-from-think-julia-book/73592)._
