Hey everyone, I've been assigned this problem for my course and I am COMPLETELY lost. I've spent the last 3 hours working on it, and even asked a friend or two with no results whatsoever. If anyone could help, that would be great.
* the comments are the instructions to complete the problem.
template <class Type>
void mergeLists(linkedListType<Type>& merged, linkedListType<Type>& list1,
linkedListType<Type>& list2)
{
linkedListIterator<int> itr;
// TODO: Implement this function, which will merge list2 with list1
// and place the data into a new list call merge.
merged = list;
for (itr = list2.begin; itr != list2.end; itr++)
{
if (itr = NULL)
return list1;
elseif (list1 = NULL)
return itr;
elseif (itr < list1)
}
// Hints:
// 1. Set merge equal to list
// 2. Use a for loop to walk through the iterator on list2, for example:
// for (itr = list2.begin; /** etc.)
// 3. Use an if-statement in the for-loop to check if the value of itr is
// in list1. Call the search() function. If it is insert itr in the
// merge list.
return;
}
As you can see I am completely lost when it comes to the third step, I have no idea of the proper syntax to use and I just feel overwhelmed. I think I am on the right track so far. (If I've messed up on the parts I've done please feel free to correct me)
Thank you in advance for the help, anything is great!