Różnice między wybraną wersją a wersją aktualną.
Both sides previous revision Previous revision Next revision | Previous revision | ||
min_element_max_element [2008/12/11 00:16] kkukolow |
min_element_max_element [2008/12/11 00:21] (aktualna) kkukolow |
||
---|---|---|---|
Linia 41: | Linia 41: | ||
if (first==last) return last; | if (first==last) return last; | ||
while (++first!=last) | while (++first!=last) | ||
- | if (*first<*lowest) // or: if (comp(*lowest,*first)) for the comp version | + | if (*first<*lowest) // or: if (comp(*first,*lowest)) for the comp version |
lowest=first; | lowest=first; | ||
return lowest; | return lowest; | ||
Linia 61: | Linia 61: | ||
===== Złożoność ===== | ===== Złożoność ===== | ||
- | Liniowa: wywołuje funkcję op i dokonuje przyporządkowania zwracanej przez nią wartości co najwyżej tylokrotnie, ile jest elementów w zakresie [first1, last1) | + | Liniowa: wykonuje operacje porównania n-1 razy, gdzie n to ilość elementów w zakresie |