create an SINGLE LINKED LISTS and reverse the data in the
lists completely
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
Which of these functions is safer to use : fgets(), gets()? Why?
Write a program to remove the C comments(/* */) and C++ comments(//) from a file. The file should be declared in command line.
Write a program to print distinct words in an input along with their count in input in decreasing order of their count..
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.
What is the diffrent between while and do while statement ?
What are .h files and what should I put in them?
How the c program is executed?
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); }
How to swap two values using a single variable ? condition: Not to use Array and Pointer ?
When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?
write a c program for greatest of three numbers without using if statment