Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How many pointers are required to reverse a link list?

Answer Posted / vivek

# 3 using 2 pointer:
void reverse(node* head_in_out)
{
if(head_in_out)
{
node* aCurr = head_in_out;
node* aNext = NULL;
while (aCurr)
{
head_in_out = aCurr->next;
aCurr->next = aNext;
aNext = aCurr;
aCurr = head_in_out;
}
head_in_out = aNext; // Bug in above 3rd answer.
}

}

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why c++ is faster than java?

1062


Difference between a homogeneous and a heterogeneous container

1144


Where do I find the current c or c++ standard documents?

1093


Write bites in Turbo c++ Header ("Include") Files.

1265


Why pointer is used in c++?

1167


What are the differences between the function prototype and the function defi-nition?

1098


How does a copy constructor differs from an overloaded assignment operator?

1043


Write a Program for dynamically intialize a 2 dimentional array. Eg:5x20, accept strings and check for vowels and display the no.finally free the space allocated .

1149


What is doubly linked list in c++?

1083


Why do we need templates?

990


What is a set in c++?

977


Is java made in c++?

1066


What is the difference between mutex and binary semaphore?

1234


What are manipulators used for?

1101


Why the usage of pointers in C++ is not recommended ?

1454