Lesson 11 of 24

STL Algorithms: sort, reverse మరియు find

10 min 30 XP

<algorithm> మీకు సిద్ధంగా ఉన్న sort, reverse, max_element, min_element, count, find, binary_search ఇస్తుంది; <numeric> accumulate ను జోడిస్తుంది. ఒక్క లైన్, చాలా పని.

Example: edit me and press Run

Output Loading C++ (first time takes a few seconds)
Press Run to see the result here.

sort() O(n log n) లో నడుస్తుంది. binary_search sorted range పై మాత్రమే పనిచేస్తుంది.

Challenge

+30 XP

n మరియు n సంఖ్యలను చదవండి. వేర్వేరు values ను ఆరోహణ క్రమంలో print చేసి, తర్వాతి లైన్‌లో ఎన్ని వేర్వేరు values ఉన్నాయో print చేయండి. Input: 7 4 1 4 2 1 9 2 Output: 1 2 4 9 4

Output Loading C++ (first time takes a few seconds)
Press Run to see the result here.