Program gives the code for the purge method of the LinkedList class. The purpose of this method is to discard the current list contents and to make the list empty again. Clearly, the running time of purge is O(1).
Program: LinkedList class purge method.