U
U
Urukhayy2015-04-08 11:52:46
Programming
Urukhayy, 2015-04-08 11:52:46

What is the fastest way to get array cell number?

There is an array of type:
{122,13523,2123,2,4,125,5600,334..n}
What is the fastest way to get a cell in which the value is 4?
Moreover, the standard option is also considered - a cycle.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Armenian Radio, 2015-04-08
@Urukhayy

If the array is not sorted (and in general, nothing is known about it) - linear search.
If sorted - binary search.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question