create an singly linked lists and reverse the lists by
interchanging the links and not the data?
Answer Posted / sumit garg( jmit mca)
\\HELLO FRIENDS CHEK THIS...IT IS TESTED\\
struct node
{
int info;
struct node * next;
};
struct node * ptr=NULL,* old=NULL,*save=NULL;
void reverse()
{
old=ptr=start;
while (ptr!=NULL)
{
ptr=ptr->next;
old->next=save;
push(old);
save=old;
old=ptr;
}
}
void push(struct node * p)
{
top++;
stack [top]=p;
}
struct node * pop()
{
struct node * ret=NULL;
ret=stack[top];
top=top-1;
return ret;
}
display(struct node * disp)
{
disp=stack[top];
while (disp->next!=NULL)
{
disp=pop();
printf("%d",disp->info);
}
| Is This Answer Correct ? | 2 Yes | 3 No |
Post New Answer View All Answers
What is hashing technique? Describe in brief.
What is red black tree in data structure?
What are types of Collision Resolution Techniques and the methods used in each of the types?
Define parent node?
Can we add or delete an element after assigning an array?
What is array define its types?
What is data in computer science?
Is list same as array?
Discuss how to implement queue using stack.
What do you mean by data and data structure?
What is a map programming?
Does arraylist maintain order?
What is map data structure?
How do I sort a hashmap key?
What is the time complexity of hashmap get () and put () method?