Professional Documents
Culture Documents
list.insertBack (newPoint);
break;
case 4 : cin >> target;
newPoint = Point(++seed, seed);
found = list.insertAfter (target, newPoint);
if (!found) cout << "Target not found\n";
break;
case 5 : cin >> target;
found = list.search (target);
if (!found) cout << "Target not found\n";
else
cout << "Target found\n";
break;
case 6 : list.makeEmpty();
cout << "List is emptied\n\n";
break;
}
} while (choice >= 1 && choice <= 6);
}
Additional Exercise: Remove A Node (20 min)
[Complete this as homework if you run out of time during tutorial session]
Add another function to perform the removal of a known node from the list.
You need to carefully consider all possible scenarios: What if the node is the last node in the linked
list? What if the node is the first node?