create an SINGLE LINKED LISTS and reverse the data in the
lists completely

Answers were Sorted based on User's Feedback



create an SINGLE LINKED LISTS and reverse the data in the lists completely..

Answer / akansha sharma

create linklist, with node having DATA which contain
information and NEXT which cointain address of next node.
The pointer START pointing to first node of linklist. PREV
pointer point to first node(where START point) and TEMP
pointer which point at last node(by traversing).

Swap data of TEMP and PREV. Now increment TEMP(TEMP=TEMP-
>NEXT) and decreament TEMP.
Repeat this untill TEMP=PREV

Is This Answer Correct ?    1 Yes 1 No

create an SINGLE LINKED LISTS and reverse the data in the lists completely..

Answer / vignesh1988i

dear sir ,
your logic might be incorrect , AND GIVE THE FULL PROGRAM SIR

sir you have told that TEMP pointer which point to the last
node.... ok ,for first you can swap the data.... ie STARTING
to TEMP. but how will you arrive at next pair of node for
swapping by decrementing the TEMP , ... a single linked
lists can travel only in one direction from HEAD till NULL
......


THANK U

Is This Answer Correct ?    0 Yes 0 No

create an SINGLE LINKED LISTS and reverse the data in the lists completely..

Answer / praveen

Push all the elements into a stack (one by one) and then
create a new list by popping of the elements from the stack

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

Are enumerations really portable?

0 Answers  


Explain how can I avoid the abort, retry, fail messages?

0 Answers  


What is the difference between exit() and _exit() function in c?

0 Answers  


Explain can you assign a different address to an array tag?

0 Answers  


Explain function pointer with exapmles.

2 Answers  


how to return 1000 variables from functio9n in c?plz give me code also

6 Answers  


What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

0 Answers   Aspire, Infogain,


Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.

0 Answers   Expedia,


different between overloading and overriding

3 Answers  


write a progam to display the factors of a given number and disply how many prime numbers are there?

2 Answers  


What is meaning of tree

0 Answers  


Write a C program to get the desired output. 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 . . . 1 n..............n 1 Note: n is a positive integer entered by the user.

4 Answers  


Categories