Tag: Algorithm
Design Sorting algorithm using Strategy Design Pattern
What is a Strategy? Strategy is a plan of action designed to achieve a long-term or overall aim. Advertisements Behaviour of a class / Algorithm depends upon the strategy they use to covert Input to Output. Frequently Asked: Design Sorting algorithm using Strategy Design Pattern If Strategy is tightly bonded with the Algorithm/Class then variation …
Design Sorting algorithm using Strategy Design PatternRead More
How to trim strings in C++ using Boost String Algorithm Library
In this tutorial we will discuss how to use trim algorithms from C++ Boost String Algorithm Library. Let’s learn them step by step, Boost String algorithm library provides different algorithms for string trimmings. Let’s first discuss the simple one i.e, What if we want to trim the string of white spaces from left side or …
How to trim strings in C++ using Boost String Algorithm LibraryRead More
STL Algorithm std::unique Tutorial
In this example we will discuss std::unique STL Algorithm. std::unique is a n STL Algorithms that provide a functionality to remove all consecutive duplicate elements from a given range. Advertisements For example, we have an array of elements i.e. 1,2,3,3,3,4,4,5,5 Frequently Asked: STL Algorithm std::unique Tutorial As we can see above there are 4 consecutive …
STL Algorithm – std::sort Tutorial and Example
In this article we will discuss STL Algorithm std::sort algorithm. std::sort is a STL Algorithm which provides the functionality of sorting a given range of elements. To use std::sort we need to pass start and end of range in it as an argument i.e. Advertisements std::sort (<START OF RANGE> , <END OF RANGE>); For example, we …
C++11 – std::all_of() – Algorithm tutorial & example
In this article we will discuss std::all_of() STL Algorithm, which is introduced in c++11. Need of std::all_of() This STL algorithm is useful when you have a range/array of element and you want to check if all elements in given range satisfies a given condition. It’s just opposite to std::any_of(). Advertisements std::all_of() Introduction all_of() accepts a range …
C++11 – std::all_of() – Algorithm tutorial & exampleRead More