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

What is an associative container in c++?

1065


Can you explicitly call a destructor on a local variable?

1028


Does c++ have a hash table?

996


If you don’t declare a return value, what type of return value is assumed?

947


Differentiate between the message and method in c++?

1068


Which command properly allocates memory a) char *a=new char[20]; b) char a=new char[20]; c) char a=new char(20.0);

1053


What are move semantics?

1150


What does the linker do?

1032


Can c++ do everything c can?

1085


Write a program in c++ to print the numbers from n to n2 except 5 and its multiples

2477


Which programming language's unsatisfactory performance led to the discovery of c++?

1332


What is the difference between interpreters and compilers?

1179


What are the four main data types?

1083


What is the arrow operator in c++?

1016


What is the basic structure of a c++ program?

1144