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

Which of these functions is safer to use : fgets(), gets()? Why?

0 Answers  


Write a program to remove the C comments(/* */) and C++ comments(//) from a file. The file should be declared in command line.

4 Answers   Persistent, Subex,


Write a program to print distinct words in an input along with their count in input in decreasing order of their count..

1 Answers  


How can I read a directory in a C program?

2 Answers   Bright Outdoor, Wipro,


1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.

0 Answers  


What is the diffrent between while and do while statement ?

6 Answers  


What are .h files and what should I put in them?

3 Answers  


How the c program is executed?

0 Answers  


What is the output for the following program #include<stdio.h> main() { char a[5][5],flag; a[0][0]='A'; flag=((a==*a)&&(*a==a[0])); printf("%d\n",flag); }

5 Answers   ADITI, Wipro,


How to swap two values using a single variable ? condition: Not to use Array and Pointer ?

6 Answers  


When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?

0 Answers  


write a c program for greatest of three numbers without using if statment

4 Answers   IBM,


Categories