8. Mohammed Sikander
Find the smallest element in the array and swap with
the first element.
Find the largest element in the array and swap with the
last element.
You should use the stl algorithms to find the largest /
smallest element in the array and swap algo to swap
the elements.
9. Mohammed Sikander
template< class InputIt, class T >
InputIt find( InputIt first, InputIt last, const T& value )
https://youtu.be/FUNs1pRJOso
10. Mohammed Sikander
template< class InputIt, class T >
int count( InputIt first, InputIt last, const T& value );
https://youtu.be/ASbv3sdmQgE
16. Mohammed Sikander
template< class RandomIt, class Compare >
void sort( RandomIt first, RandomIt last, Compare comp );
The signature of the comparison function should be equivalent to the following:
bool cmp(const Type1 &a, const Type2 &b);
https://youtu.be/n9SRg4XBd7Y
19. Mohammed Sikander
Given a list of numbers, count the
numbers which are prime.
12, 21, 34, 32, 5, 65, 34, 23, 43
20. Mohammed Sikander
template< class InputIt, class UnaryPredicate >
int count_if( InputIt first, InputIt last, UnaryPredicate p );
https://youtu.be/ASbv3sdmQgE
22. Mohammed Sikander
Given an array of numbers, find all the
numbers which are prime and print them
on screen.
Use find_if to find the next prime number
in array.