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
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 |
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 |
Answer / siva
head points 20
head=head->link;
link->next;
link->head=head->next
| Is This Answer Correct ? | 1 Yes | 3 No |
Describe the My Computer and My Documents folders; identify the elements that are present in every Window.
sir please send me bpcl previous question papers
0 Answers BPCL Bharat Petroleum,
What are the components of stl?
How stl is different from the c++ standard library?
What is meant by stl in c++?
If P is the population on the first day of the year, B is the birth rate, and D is the death rate, the estimated population at the end of the year is given by the formula: The population growth rate is given by the formula: B – D Write a program that prompts the user to enter the starting population, birth and death rates, and n, the number of years. The program should then calculate and print the estimated population after n years. Your program must have at least the following functions: 1. growthRate: This function takes its parameters the birth and death rates, and it returns the population growth rate. 2. estimatedPopulation: This function takes its parameters the current population, population growth rate, and n, the number of years. It returns the estimated population after n years Your program should not accept a negative birth rate, negative death rate, or a population less than 2. please answer my question ....
Do you like to Submit Questions in Bulk under Same Category?? Then use our Bulk ListerDo you like to Submit Questions in Bulk under Same Category?? Then use our Bulk Lister
Who created stl?
How Find, Replace and Go To commands ca be used to substitute one character string for another? Explain with the heIp of an example.
help me i need a c++ program which takes sequesnce of characters and outputed sequence of their token taypes, work same compiler in lexical analysis phase
What is the STL?
wap in c++ which accept a integer array and its size as argument and replaces element having even values with its half and element having odd values with twice its value