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 to swap two numbers in a linked list without exchanging
the data but only the links?

Answers were Sorted based on User's Feedback



how to swap two numbers in a linked list without exchanging the data but only the links?..

Answer / sha

let q=20,r=10 and p be a node previous to q
sequence is p-q-r
temp is pointer of link list.
then
temp=p->next;
p->next=temp->next;
p->next->next=temp;
and temp next can be conected to p->next->next->next if
there is any

Is This Answer Correct ?    4 Yes 0 No

how to swap two numbers in a linked list without exchanging the data but only the links?..

Answer / pavny

Suppose List contains 3 no. 10, 20, 30
try to exchange 10 and 20.
head points to 10.

temp = head;
head = head -> next;
temp -> next = head - next;
head -> next = temp;

I think it works..

Is This Answer Correct ?    3 Yes 2 No

how to swap two numbers in a linked list without exchanging the data but only the links?..

Answer / siva

head points 20
head=head->link;
link->next;
link->head=head->next

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More STL Interview Questions

Explain when u will use Observer pattern and how u will implement in c++ .

1 Answers  


Distinguish between: a) Normal layout & Print Layout views b) Windows Clipboard & office Clipboard c) Save & Save As Commands d) Program File & Data File e) Pie Charts & Barr Charts

0 Answers  


Why should a c++ programmer be interested in stl?

0 Answers  


Is stl open source?

0 Answers  


What is the STL?

2 Answers   Epson, HP,


what is the difference between thread and process

1 Answers   Infosys,


What is stl in oop?

0 Answers  


What is the use of stl?

0 Answers  


Describe the My Computer and My Documents folders; identify the elements that are present in every Window.

0 Answers  


write a program that will accept a number and print.its equivalent in words the maximum input number is 9999

0 Answers  


write a program to search and display the position of an element in a single-dimentional array using function.

1 Answers  


What two types of containers does the stl provide?

0 Answers  


Categories