Implement a algorithm to verify if the link list , C/C++ Programming

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;



nodeptr temp = nextptr->_next;

nextptr->_next = ptr;

ptr = nextptr;

nextptr = temp;


head->_next = 0;

head = ptr;


Posted Date: 3/20/2013 3:52:36 AM | Location : United States

Related Discussions:- Implement a algorithm to verify if the link list , Assignment Help, Ask Question on Implement a algorithm to verify if the link list , Get Answer, Expert's Help, Implement a algorithm to verify if the link list Discussions

Write discussion on Implement a algorithm to verify if the link list
Your posts are moderated
Related Questions
I need website Product section search box coding section fix Project Description: On our products section in the search box it only searches the name and title of our product

A: Depends. Might be "zero" Objects which are thrown must have a publicly accessible copy-constructor. The compiler is permitted to generate code which copies the thrown object

A: 1.      By using const protects you against programming errors which inadvertently alter data. 2.      By using const allows function to procedure const and non-const actu

Write a program to calculate the average of ten numbers       #include stdio.h     /* Only this header is needed since only IO are used */     void main()     {          char

Create a user-defined data structure (struct) called Node that represents a node within a linked list where the "data" stored in each node is a pointer to a Car object.    a) Wr

Ask question #Minimum 100Problem : Compiler Design - Limit the methods Rahul is a newbie to the programming and while learning the programming language he came to know the followi

Memory Management Operator In C malloc( ), calloc( ), realloc( ), and free( ) are used to mange dynamic memory.  In addition to these function C++ have derived two unary ope

Is it probable to encompass Virtual Constructor? If yes, how? If not, Why?

Project Description: Prepare software that will work with our USB hardware that easily lets you backup all the pictures in your computer into the USB stick in one single step. Once