Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool LinkedList::deleteFourth()
- {
- int count = 1;
- if(this->length() < 4) return false;
- for(Node *temp=head; temp!=NULL; temp=temp->getNext())
- {
- if(count == 3)
- {
- if((temp->getNext()->getNext()) == NULL)
- {
- temp->setNext(NULL);
- return true;
- }
- else
- {
- temp->setNext(temp->getNext()->getNext());
- return true;
- }
- }
- count++;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement