merge() Function in C++

This C++ program merges two sequences using merge() algorithm. This algorithm combines the elements present in the two sorted ranges into a new range given as an argument to the merge() routine. Here is the source code of the C++ program which merges two sequences using merge() algorithm. The C++ program is successfully compiled and … Read more

advertisement

random_shuffle() Function in C++

This C++ program demonstrates the random_shuffle() algorithm. The function random_shuffle() shuffles the elements of a container in a uniformly random manner. The function takes two iterators to the beginning and end of the container as parameters. The program creates a set of cards, randomly shuffles and randomly opens three cards from the set. Here is … Read more

advertisement

rotate_copy() Function in C++

This C++ program demonstrates the rotate_copy() algorithm. The function rotate_copy() takes four iterators as parameters – first iterator to the beginning of container, second iterator to element by which the elements are rotated, third iterator to the end of the set of elements to be rotated and the fourth iterator to the starting of the … Read more

advertisement

rotate() Function in C++

This C++ program demonstrates the rotate() algorithm. The function rotate() takes three iterators as parameters – first iterator to the beginning of container, second iterator to element by which the elements are rotated and the third iterator to the end of the set of elements to be rotated. The program demonstrates the use of the … Read more

advertisement

reverse_copy() in C++

This C++ program demonstrates the reverse_copy() algorithm. The function reverse_copy() takes three iterators as parameters – two iterators to the beginning and the end of the container elements to be reversed and the third iterator to the container where reversed elements are to be saved. The program demonstrates the use of the algorithm which doesn’t … Read more

advertisement

reverse() Function in C++

This C++ program demonstrates the reverse() algorithm. The function reverse() takes two iterators as parameters and reverses the order of the elements of the container. The program creates a string array and reverses the order of the strings. Here is the source code of the C++ program which demonstrates the reverse() algorithm. The C++ program … Read more

advertisement

unique_copy() Function in C++

This C++ program demonstrates the unique_copy() algorithm. The function unique_copy() takes three iterators as parameters – iterators to the beginning and end of the container and iterator to the container or output stream where the unique elements would be copied. The program demonstrates the use of the algorithm which removes the adjacent duplicate characters in … Read more

advertisement

unique() Function in C++

This C++ program removes equal adjacent elements using unique() algorithm. The algorithm removes duplicate characters which are adjacent to each other in a container. The program creates an array of characters and runs the algorithm on the array. The array elements are then printed on the standard output. Here is the source code of the … Read more

advertisement

remove_if() Function in C++

This C++ program demonstrates the remove_if() algorithm. The program creates a vector of strings and removes elements whose first letter is ‘A’ using predicate which is passed as a parameter to the remove_if algorithm which removes elements for which the predicate returns true. Here is the source code of the C++ program which demonstrates the … Read more

advertisement

remove() Function in C++

This C++ program demonstrates the remove() algorithm. The program creates a vector of strings and removes an element using the remove algorithm from the algorithm library. Here is the source code of the C++ program which demonstrates the remove() algorithm. The C++ program is successfully compiled and run on a Linux system. The program output … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.