php algorithm problem

WBOY
Release: 2016-09-23 11:31:04
Original
1004 people have browsed it

php algorithm problemHow to tell which one is better

Reply content:

php algorithm problemHow to tell which one is better

In fact, both are O(n), which is consistent in terms of time complexity.
If I have to say which one is the best, it must be A2, because the time complexity increases with the increase of scale n, and the increment is the smallest.

The quality of the algorithm is mainly reflected when the scale is large. You will find how bad the algorithm is. When the scale is small, the current computer power can be completed instantly. Only when the scale is large can the algorithm be shown to be good. Bad, the scale is at least 10,000, that is, n=10,000. The algorithm complexity at this time is of practical significance. So you just look at the big n, whichever one is faster will be better

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!