How would I iterate through a vector when given a const int* tothe first element.
In this method, first is the pointer to the beginning of avector, last is a pointer to its end.
Ex: node toTree(const int* first, const int* last){
}
Solution
void toTree(const int*first, const int*last)
{
// point trav to first
int *trav =first;
// traverse the vector
while( trav!= last )
{
printf(“%d “,*trav);
// go to nextelement
trav++;
}
}