Help with Merging Lists

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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;
		else if (list1 = NULL)
			return itr;
		else if (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!
Topic archived. No new replies allowed.