C FORMAT PLEASE how to finish this function with the comment
C++ FORMAT PLEASE:
how to finish this function with the comment requirements
template <class listdata>
bool List<listdata>:: isSorted()
{
if (size ==0)
{
return isSorted();
}
else
reverse (last);
return true;
}
//Wrapper function that calls the isSorted helper function to determine whether
//a list is sorted in ascending order.
//We will consider that a list is trivially sorted if it is empty.
//Therefore, no precondition is needed for this function
Solution
Hi,
The method stated is not correct. please see the below methods to see:
This method will be used as follows:
Use the above mentioned two code snippets for the answer
|   template <class ForwardIterator>    bool is_sorted (ForwardIterator first, ForwardIterator last)  {    if (first==last) return true;    ForwardIterator next = first;    while (++next!=last) {      if (*next<*first)     // or, if (comp(*next,*first)) for version (2)        return false;      ++first;    }    return true;  }   | 

