April 2018
Intermediate to advanced
322 pages
6h 57m
English
Similar to the inserting operation, the removing operation also has several cases, and they are:
For case 1, the implementation is straightforward. We just need to point the Head pointer to the node which is pointed by the Next pointer of the current Head (in other words, the second element) and delete the first element of the linked list. Please see the following code:
template <typename T>void LinkedList<T>::RemoveHead(){ // Do nothing if list is empty if(m_count == 0) return; // Save the current Head // to ...