Recently I got the above question. Here, $
(a non-numeric) data is to be find out in an array
whose N
(Length) is not known. One simplest approach is linear search
by going one by one and comparing with symbol $
but it requires O(N)
and N is not known
. Is there any feasible solution to above question
I know Binary Search
, but It requires Bounded End points. I searched more and found that Exponential Search
that says increasing
the Right-bound
by factor
of 2
of Binary Search
until the range
got where the Element will surely present. But here $ as a non-numeric character How will we get the range that confirms as $ is incomparable to numbers ?