C++ FORMAT: please write functions for all these, in c++ format but a List class
ID: 3788124 • Letter: C
Question
C++ FORMAT: please write functions for all these, in c++ format but a List class with template : template <class listdata> for ints
1. Please write the recursive List reverse print function
void printReverse();
//Wrapper function that calls the reverse helper function to print a list in reverse
//prints nothing if the List is empty
2. add an index to the nodes in the List class
int getIndex();
//Indicates the index of the Node where the iterator is currently pointing
//Nodes are numbered from 1 to size of the list
//Pre: size != 0
//Pre: !off_end()
3. Write a function for advancetoindex
void advanceToIndex(int index);
//Moves the iterator to the node whose index number is specified in the parameter
//Pre: size != 0
//Pre: index <= size
4. Write a recursive function to determine whether or not a Linked List is in sorted order (smallest value to largest value).
bool isSorted();
//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
Explanation / Answer
*Functions:- Functions are generally group of statements which perform task together.In every C++ program there is always presence of on Function i.e. Main().
*Definig a Funtion:-The general form of defining a function is:-
return_type function_name(parameter list) {
body of funtion
}
1.the recursive List reverse print function.
#include <iostream>
2.add an index to the nodes in the List class.
3.function for advance to index.
"It" is a random access iterator the function uses only once operator + or operator --
Example:-
.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.