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

Write a programm such that if user enter 11.25 it roundup to 11 but if user enter 11.51 upto 11.99 it will round up to 12 i.e.;convert the floting point value into integer format as explain above..

2 Answers  


What is the process to generate random numbers in c programming language?

0 Answers  


write the program for prime numbers?

73 Answers   Accenture, Aptech, Infosys, TCS,


int x=5; printf("%d%d%d",x,x<<2,x>>2);

2 Answers   TANCET,


How can I implement a delay, or time a users response, with sub-second resolution?

0 Answers  






Why header files are used?

0 Answers  


What is array of structure in c?

0 Answers  


Can you please explain the difference between syntax vs logical error?

0 Answers  


What are the differences between Structures and Arrays?

0 Answers   TCS,


what is inline function?

2 Answers  


How we add our function in liabrary as liabrary function. Exp. we want use our int factorical(int); function as int pow(int,int); function working in math header file.

1 Answers  


What is storage class?

0 Answers  


Categories