can i know the source code for reversing a linked list with
out using a temporary variable?
Answers were Sorted based on User's Feedback
#include<stdio.h>
struct node *head;
void main();
{
//consider head is the first node
reverse(head);
//here print the reversed link list ...thank you;
}
reverse(struct node *cur)
{
if(cur->next==NULL)
reveres(cur->next)
else{temp=head=cur;}
temp->next=cur;
temp=temp->next;
temp->next=NULL;
}
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / vishnu948923
struct node* reverse(struct node* first)
{
struct node* cur, temp;
cur=NULL;
while(first!=NULL)
{
temp=first;
first=first->link;
temp->link=cur;
cur=temp;
}
return cur;
}
Is This Answer Correct ? | 5 Yes | 5 No |
Answer / ruchi
void reverse()
{
nptr p;
int i=0;
p=start;
while(p->next!=NULL)
{
p=p->next;
i=i+1;
}
i++;
while(i)
{
printf("%d\n",p->num);
p=p->prev;
i--;
}
}
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / fazil
void Func( struct Node* List )
{
if( List && List->Next )
{
Func( List->Next );
List->Next->Next = List;
}
}
Is This Answer Correct ? | 2 Yes | 3 No |
Answer / zhangwy
void Func( struct Node* List )
{
if( List && List->Next )
{
Func( List->Next );
List->Next->Next = List;
List->next = NULL ;
}
}
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / abdur rab
struct node* reverse ( struct node* head )
{
struct node* temp;
if ( NULL == head -> next ) temp = head;
else {
temp = reverse ( head -> next );
head -> next -> next = head;
head -> next = NULL;
}
return ( temp );
}
Is This Answer Correct ? | 0 Yes | 3 No |
Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?
52.write a “Hello World” program in “c” without using a semicolon? 53.Give a method to count the number of ones in a 32 bit number? 54.write a program that print itself even if the source file is deleted? 55.Given an unsigned integer, find if the number is power of 2?
hi any body pls give me company name interview conduct "c" language only
Symmetric technologies interview questions. For Computer science candidates the first round is a objective type written test consisting of 16 questions.It is very easy ,any police man can solve this. And next round is a written test consists of both objective and subjective .Total 40 question related to c,c++ and operating system related questions. And then a technical interview and give some program to solve with computer.The md is adamant person, whatever he says we have to accept that is the condition. And one more thing ,,,these interview is just for a formality..the company will select only innocent guys.. the person's without a backbone only they require.. And u have to submit the certificates this is the most important problem...So if you are not getting any other jobs..then only join with this... It is better to try for other company...And apart from that symmetric do a lot of projects..If a candidate can manage everything u can join and make good career with this company... The Md will normally speak rudely..but he is good person and he will give you a lot of very good chances to improve your career....but with cheap salary....
0 Answers Symmetric Technologies,
When c language was developed?
#include<stdio.h> int main() { int i=0,j=1,k=2,m,n=0; m=i++&&j++&&k++||n++; printf("%d,%d,%d,%d,%d",i,j,k,m,n); }
12 Answers Capital IQ, Sasken,
Find errors (1) m = ++a*5; (2) a = b ++ -c*2; (3)y = sqrt (1000);
Write a program to print factorial of given number using recursion?
What is mean by data types in c?
what is the stackpointer
State the difference between x3 and x[3].
What is binary tree in c?