Open davidefa opened 1 year ago
Added swap method as follow:
/* Swap objects at index and index1; */ virtual bool swap(int index, int index1);
template<typename T> bool LinkedList<T>::swap(int index, int index1){ // Check if index position is in bounds if(index < 0 || index >= _size) return false; if(index1 < 0 || index1 >= _size) return false; T _t = getNode(index)->data; getNode(index)->data = getNode(index1)->data; getNode(index1)->data = _t; return true; }
Added swap method as follow: