implement a algorithm to verify if the link list


Implement a Algorithm to verify if the link list is in Ascending order?

A: template

bool linklist::isAscending() const{

nodeptr ptr = head;

while (ptr->_next)         

{

if(ptr->_data > ptr->_next->_data)

return false;

ptr= ptr->_next;

}

return true;

}

Q: Write down an algorithm to reverse a link list?

A: template

void linklist::reverselist()

{

nodeptr ptr= head;

nodeptr nextptr= ptr->_next;

while(nextptr)

{

nodeptr temp = nextptr->_next;

nextptr->_next = ptr;

ptr = nextptr;

nextptr = temp;

}

head->_next = 0;

head = ptr;

}

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: implement a algorithm to verify if the link list
Reference No:- TGS0217745

Expected delivery within 24 Hours