C
C
cybran242019-03-24 14:46:01
Algorithms
cybran24, 2019-03-24 14:46:01

Fastest algorithm to find the largest value in an unsorted array?

Perhaps a linear search? But it is not used in production, as far as I know. Then, Search with sorting? But after all, time is also spent on sorting, and it turns out that it is inferior in speed to a linear one?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dollar, 2019-03-24
@cybran24

in unsorted array

That is an exhaustive search .
Do you need the fastest algorithm or match (imaginary) production?

X
xmoonlight, 2019-11-29
@xmoonlight

(If it happened!)
In 2 consecutive passes.
1. By the amount of data in each element of the array (the amount of memory occupied by the data).
2. According to the data itself, in the array elements with the largest amount of memory occupied.
This will be much faster than directly comparing the data by direct enumeration.
In general, such cases as the appearance or presence of an unsorted array indicate that the architect of a software solution / complex does not know how to work with data at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question