C++

STL algorithms (sort, find)

Në shqip: Algoritmet e STL-së

ShpjegimiSQ

Libraria <algorithm> ka funksione të gatshme për punët e zakonshme: sort() rendit, find() kërkon, reverse() kthen mbrapsht, max_element() gjen më të madhin. Janë të testuara dhe shumë të shpejta.

EnglishEN

The <algorithm> library has ready-made functions for common jobs: sort() orders, find() searches, reverse() flips, max_element() finds the biggest. They're well tested and very fast.

Si ta mendosh

Si makinat në një furrë të madhe buke: një që përzien brumin, një që e pret — s'ke pse i bën të gjitha me dorë.

Lexoje në anglisht

Like the machines in a big bakery: one mixes the dough, one slices — you don't do it all by hand.

Shembull kodicpp

#include <algorithm>
std::vector<int> v = {4, 1, 3};
std::sort(v.begin(), v.end());           // 1 3 4
std::reverse(v.begin(), v.end());        // 4 3 1

Terma të lidhur