The std::min_element, std::max_element and (C++11) std::minmax_element are min-max algorithms that operate on top of iterators, returning an iterator to the minimum/maximum element. The algorithms provide parallel (C++17) variants and are constexpr and range enabled (C++20). C++20 also offers a simpler alternative: a range overload of the base min-max algorithms. Compiler Explorer link: https://lnkd.in/enZSnYbn #cpp #cplusplus #coding #programming #dailybiteofcpp
Šimon Tóth’s Post
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
Meta•5K followers
2ya little less known fact is that using std::minmax_element is more efficient than using std::min_element and std::max_element separately. Its complexity is at most max(floor((3/2)*(N−1)), 0) which is why this used to be a fairly common interview questions at FAANG.