-
Notifications
You must be signed in to change notification settings - Fork 116
Open
Description
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;
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels