ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
create an SINGLE LINKED LISTS and reverse the data in the 
lists completely
 Question Submitted By :: Vignesh1988i
I also faced this Question!!     Rank Answer Posted By  
 
  Re: create an SINGLE LINKED LISTS and reverse the data in the lists completely
Answer
# 1
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
Akansha Sharma
 
  Re: create an SINGLE LINKED LISTS and reverse the data in the lists completely
Answer
# 2
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
Vignesh1988i
 
 
 
  Re: create an SINGLE LINKED LISTS and reverse the data in the lists completely
Answer
# 3
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
Praveen
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
Whats wrong with the following function char *string() { char *text[20]; strcpy(text,"Hello world"); return text; } Qualcomm3
HOW TO FIND OUT THE RREVERS OF A GIVEN DIGIT NUMBER IF IT IS INPUT THROUGH THE KEYBORD BY USING C LANGUAGE  2
how to implement stack operation using singly linked list  1
Main must be written as a.the first function in the program b.Second function in the program c.Last function in the program d.any where in the program TCS12
Why is conio.h not required when we save a file as .c and use clrscr() or getch() ?  2
what is the function of .h in #include<stdio.h> in c ? IBM9
What's wrong with the call "fopen ("c:\newdir\file.dat", "r")"?  1
f(char *p) { p=(char *)malloc(sizeof(6)); strcpy(p,"HELLO"); } main() { char *p="BYE"; f(p) printf("%s",p); } what is the output? Hughes6
Write a C program that reads a series of strings and prints only those ending in "ed"  2
what is the output of the following program? main() { int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,m); }  7
Write a program that takes three variables(a,b,c) in as separate parameters and rotates the values stored so that value a goes to b,b,to c and c to a  3
How do I declare a pointer to an array?  5
#define min((a),(b)) ((a)<(b))?(a):(b) main() { int i=0,a[20],*ptr; ptr=a; while(min(ptr++,&a[9])<&a[8]) i=i+1; printf("i=%d\n",i);}  3
regarding the scope of the varibles;identify the incorrect statement: a.automatic variables are automatically initialised to 0 b.static variables are are automatically initialised to 0 c.the address of a register variable is not accessiable d.static variables cannot be initialised with any expression TCS1
can we access one file to one directory?  1
How to use c/c++ code in JAVA Satyam7
how many argument we can pas in in a function CTS20
#define swap1(a,b) a=a+b;b=a-b;a=a-b; main() { int x=5,y=10; swap1(x,y); printf("%d %d\n",x,y); swap2(x,y); printf("%d %d\n",x,y); } int swap2(int a,int b) { int temp; temp=a; b=a; a=temp; return; } what are the outputs? Ramco4
Write a C function to search a number in the given list of numbers. donot use printf and scanf Honeywell6
suppose we use switch statement and we intilize years name using enum statement like(jan,feb,mar,------dec) we take integer value as an input .question is that the month which we analyz is from 0 to 11 bt if i enter 12 than how he again starts from begning and print jan  1
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com