Implement these three functions in C++ in the code below selectionSort: sort the provided range using selection sort

computer science

Description

Implement these three functions in C++ in the code below

selectionSort: sort the provided range using selection sort

reverseRange: reverse the range

printRange: print the range

Do not modify the test code in each function. You can look at that code for some ideas for implementing the methods.

Note: This is an exercise on iterators, so use their basic functionality (increment, decrement, dereference, compare) to implement the functions yourself. Do not call standard library functions to do loops on the given ranges for you. Also, note that selectionSort is to operate in place, without making a copy of the data, while for reverseRange you can make use of the data copy it makes (though you still have to reverse the original range).

#include <algorithm>

 

#include <iostream>

 

#include <vector>

 

 

 

template <class Iter>

 

void selectionSort(Iter begin, Iter end) {

 

/*******Your code here********/

 

 

/*****************************/

 

/***Test code: do not modify***/

 

typedef typename std::iterator_traits<Iter>::value_type value_type;


Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.